The captives were gathered, and Dihya came and said, "Prophet of Allah, give me a slave girl from the captives."He said, "Go and take a slave girl."So he took Safiya bint Huyayy. Then a man came to the Prophet ﷺ and said, "Prophet of Allah, you have given Dihya Safiya bint Huyayy, the chief lady of Qurayza and Nadir. She is fit for none but you."He said, "Call him to bring her."He brought her, and when the Prophet ﷺ looked at her, he said, "Take another slave girl from the captives instead of her."
في سياق قصة خيبر:
فجمع السبي فجاء دحية رضي الله عنها فقال: يا نبي الله أعطني جارية من السبي، قال: اذهب فخذ جارية فأخذ صفية بنت حيي فجاء رجل إلى النبي ﷺ فقال: يا نبي الله أعطيت دحية صفية بنت حيي سيدة قريظة والنضير لا تصلح إلا لك قال: ادعوه بها فجاء بها فلما نظر إليها النبي ﷺ قال: خذ جارية من السبي غيرها.
Bukhari narrated it in the Prayer chapter (371), and Muslim narrated it in the Marriage chapter (1365: 84), both of them through Ismail bin Ulaya, from Abdul-Aziz bin Suhayb, from Anas bin Malik, who mentioned it in the course of the story of Khaybar.