كتاب الْمَسَاجِدِ وَمَوَاضِعِ الصَّلاَةِ
5  
The Book of Mosques and Places of Prayer
(3)
Chapter: The prohibition of building masajid over graves and placing images therein; and the prohibition of taking graves as masajid
(3)
باب النَّهْيِ عَنْ بِنَاءِ الْمَسَاجِدِ عَلَى الْقُبُورِ وَاتِّخَاذِ الصُّوَرِ فِيهَا وَالنَّهْيِ عَنِ اتِّخَاذِ الْقُبُورِ مَسَاجِدَ
Sahih Muslim 531

'A'isha and Abdullah reported:

As the Messenger of Allah (ﷺ) was about to breathe his last, he drew his sheet upon his face and when he felt uneasy, he uncovered his face and said in that very state: Let there be curse upon the Jews and the Christians that they have taken the graves of their apostles as places of worship. He in fact warned (his men) against what they (the Jews and the Christians) did.
وَحَدَّثَنِي هَارُونُ بْنُ سَعِيدٍ الأَيْلِيُّ، وَحَرْمَلَةُ بْنُ يَحْيَى، قَالَ حَرْمَلَةُ أَخْبَرَنَا وَقَالَ، هَارُونُ حَدَّثَنَا ابْنُ وَهْبٍ، أَخْبَرَنِي يُونُسُ، عَنِ ابْنِ شِهَابٍ، أَخْبَرَنِي عُبَيْدُ اللَّهِ بْنُ عَبْدِ اللَّهِ، أَنَّ عَائِشَةَ، وَعَبْدَ اللَّهِ بْنَ عَبَّاسٍ، قَالاَ لَمَّا نَزَلَتْ بِرَسُولِ اللَّهِ صلى الله عليه وسلم طَفِقَ يَطْرَحُ خَمِيصَةً لَهُ عَلَى وَجْهِهِ فَإِذَا اغْتَمَّ كَشَفَهَا عَنْ وَجْهِهِ فَقَالَ وَهُوَ كَذَلِكَ ‏ "‏ لَعْنَةُ اللَّهِ عَلَى الْيَهُودِ وَالنَّصَارَى اتَّخَذُوا قُبُورَ أَنْبِيَائِهِمْ مَسَاجِدَ ‏"‏ ‏.‏ يُحَذِّرُ مِثْلَ مَا صَنَعُوا ‏.‏
Reference : Sahih Muslim 531
In-book reference : Book 5, Hadith 27
USC-MSA web (English) reference : Book 4, Hadith 1082
  (deprecated numbering scheme)