Sunan an-Nasa'i, Book 21, Hadith 229 (Nasa'i 2051)

It was narrated from Aishah that the Prophet said:

"May Allah curse people who take the graves of their prophets as Masjids."