Sayyiduna Abdullah bin Abbas (may Allah be pleased with them both) said: He (peace and blessings be upon him) came to a fallen-in grave and offered the funeral prayer over it, and we also prayed with him (peace and blessings be upon him).
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجنائز / 7006