Sunan an-Nasa'i 2022
It was narrated from Yazid bin Thabit that:
they went out with the Messenger of Allah one day and he saw a new grave. He said: "What is this?" They said: "This is so-and-so, the freed slave woman of Banu so-and-so" - whom Messenger of Allah knew - "She died at midday and we did not like to wake you up when you were fasting and taking a nap." The Messenger of Allah stood (for prayer) and the people formed rows behind him. He said four Takbirs over her then he said: "If anyone among you dies while I am still among you, inform me, for my prayer for his is a mercy."
أَخْبَرَنَا عُبَيْدُ اللَّهِ بْنُ سَعِيدٍ أَبُو قُدَامَةَ، قَالَ حَدَّثَنَا عَبْدُ اللَّهِ بْنُ نُمَيْرٍ، قَالَ حَدَّثَنَا عُثْمَانُ بْنُ حَكِيمٍ، عَنْ خَارِجَةَ بْنِ زَيْدِ بْنِ ثَابِتٍ، عَنْ عَمِّهِ، يَزِيدَ بْنِ ثَابِتٍ ‏:‏ أَنَّهُمْ خَرَجُوا مَعَ رَسُولِ اللَّهِ صلى الله عليه وسلم ذَاتَ يَوْمٍ، فَرَأَى قَبْرًا جَدِيدًا فَقَالَ ‏:‏ ‏"‏ مَا هَذَا ‏"‏ ‏.‏ قَالُوا ‏:‏ هَذِهِ فُلاَنَةُ مَوْلاَةُ بَنِي فُلاَنٍ، فَعَرَفَهَا رَسُولُ اللَّهِ صلى الله عليه وسلم مَاتَتْ ظُهْرًا وَأَنْتَ نَائِمٌ قَائِلٌ، فَلَمْ نُحِبَّ أَنْ نُوقِظَكَ بِهَا ‏.‏ فَقَامَ رَسُولُ اللَّهِ صلى الله عليه وسلم وَصَفَّ النَّاسَ خَلْفَهُ وَكَبَّرَ عَلَيْهَا أَرْبَعًا ثُمَّ قَالَ ‏:‏ ‏"‏ لاَ يَمُوتُ فِيكُمْ مَيِّتٌ مَا دُمْتُ بَيْنَ أَظْهُرِكُمْ إِلاَّ آذَنْتُمُونِي بِهِ، فَإِنَّ صَلاَتِي لَهُ رَحْمَةٌ ‏"‏ ‏.‏