Abu Hurairah reported,

A Black man, or perhaps a woman, used to be at the mosque sweeping it, and he died without the Prophet ﷺ being informed of his death. One day, the Prophet ﷺ mentioned him and asked, "What happened to that person?"They said, "He died, Messenger of Allah."He said, "Why did you not inform me?"They replied, "His situation was such and such," recounting his story. They had considered his affair too insignificant.He said, "Show me his grave."So he went to his grave and prayed over him.

Bukhari 1337

Sahih

حدثنا محمد بن الفضل حدثنا حماد بن زيد عن ثابت عن أبي رافع

عن أبي هريرة رضي الله عنه

أن أسود رجلا أو امرأة كان يكون في المسجد يقم المسجد فمات ولم يعلم النبي ﷺ بموته فذكره ذات يوم فقال ما فعل ذلك الإنسان قالوا مات يا رسول الله قال أفلا آذنتموني فقالوا إنه كان كذا وكذا قصته قال فحقروا شأنه قال فدلوني على قبره فأتى قبره فصلى عليه

البخاري 1337صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Funerals
Chapter
Prayer over the grave after burial
Numbering
Darussalam 1337
Bukhari 1337