It is narrated from Ali (may Allah be pleased with him), he says: I said, "O Messenger of Allah (ﷺ)! May my parents be sacrificed for you, indeed my father has passed away." The Prophet (ﷺ) said, "Go and bury him in the ground." I said, "He died in a state of polytheism." The Prophet (ﷺ) said, "Go and bury him in the ground." When I had buried him in the ground and came to the Prophet (ﷺ), he said, "Go and take a bath."
Hadith Referenceمسند الإمام الشافعي / كتاب الطهارة / 102
Hadith Takhrijاخرجه النسائی: الجنائز، باب مواراة المشرک (2008) و ابوداود، الجنائز، باب الرجل يموت له قرابة مشرك (3214) - وصححه ابن الجارود (550)