(67) باب الصَّلاَةِ عَلَى مَنْ عَلَيْهِ دَيْنٌ
It was narrated from Abu Hurairah that:
if a believer died with debts outstanding, the Messenger of Allah would ask whether he had left behind anything to pay off his debts. If they said yes, he would pray for him, but if they said no, he would say: "Pray for your companion." Then, when Allah made His Messenger rich through conquest, he said: "I am closer to the believers than their own selves. Whoever dies and leaves behind a debt, I will pay it, and whoever leavers behind wealth, it is for his heirs."
Reference: Sunan an-Nasa'i 1963
In-book reference: Book 21, Hadith 147
English translation: Vol. 3, Book 21, Hadith 1965