Sunan Abi Dawud, Book 11, Hadith 2046 (USC-MSA)

Narrated Abdullah ibn Amr ibn al-'As: Marthad ibn AbuMarthad al-Ghanawi used to take prisoners (of war) from Mecca (to Medina). At Mecca there was a prostitute called Inaq who had illicit relations with him. (Marthad said:) I came to the Prophet and said to him: May I marry Inaq, Messenger of Allah? The narrator said: He kept silence towards me. Then the verse was revealed:"....and the adulteress none shall marry save and adulterer or an idolater." He called me and recited this (verse) to me, and said: Do not marry her.

حَدَّثَنَا إِبْرَاهِيمُ بْنُ مُحَمَّدٍ التَّيْمِيُّ، حَدَّثَنَا يَحْيَى، عَنْ عُبَيْدِ اللَّهِ بْنِ الأَخْنَسِ، عَنْ عَمْرِو بْنِ شُعَيْبٍ، عَنْ أَبِيهِ، عَنْ جَدِّهِ، أَنَّ مَرْثَدَ بْنَ أَبِي مَرْثَدٍ الْغَنَوِيَّ، كَانَ يَحْمِلُ الأُسَارَى بِمَكَّةَ وَكَانَ بِمَكَّةَ بَغِيٌّ يُقَالُ لَهَا عَنَاقُ وَكَانَتْ صَدِيقَتَهُ قَالَ جِئْتُ إِلَى النَّبِيِّ صلى الله عليه وسلم فَقُلْتُ يَا رَسُولَ اللَّهِ أَنْكِحُ عَنَاقَ قَالَ فَسَكَتَ عَنِّي فَنَزَلَتْ ‏{‏ وَالزَّانِيَةُ لاَ يَنْكِحُهَا إِلاَّ زَانٍ أَوْ مُشْرِكٌ ‏}‏ فَدَعَانِي فَقَرَأَهَا عَلَىَّ وَقَالَ ‏"‏ لاَ تَنْكِحْهَا ‏"‏ ‏.‏

sunnah.com