The Book of Prayers (Kitab Al-Salat)
Muslim :: Book 4 : Hadith 2014
A hadith like this is narrated with the same chain of transmitters but with the addition of these words:" The Apostle of Allah (may peace be upon him) happened to pass by a woman (who was sitting) by the side of a grave."