Abdullah bin Umar reported,

When Abdullah bin Ubayy bin Salul died, his son Abdullah bin Abdullah came to the Messenger of Allah ﷺ and asked him to give him his shirt so that he might shroud his father in it, and the Messenger gave it to him. Then he asked him to pray over him, so the Messenger of Allah ﷺ stood to pray over him.Umar rose and took hold of the garment of the Messenger of Allah ﷺ and said, "Messenger of Allah, are you going to pray over him when Allah has forbidden you to pray over him?"The Messenger of Allah ﷺ replied, "Allah has only given me a choice. He said, 'Ask forgiveness for them or do not ask forgiveness for them. Even if you ask forgiveness for them seventy times' [Tawbah 9:80], and I shall do more than seventy."Umar said, "He is a hypocrite."So the Messenger of Allah ﷺ prayed over him, and Allah عز وجل revealed, "And never pray over any of them who has died, nor stand at his grave" [Tawbah 9:84].

Muslim 6207

Sahih

حدثنا أبو بكر بن أبي شيبة حدثنا أبو أسامة حدثنا عبيد الله عن نافع

عن ابن عمر قال

لما توفي عبد الله بن أبي ابن سلول جاء ابنه عبد الله بن عبد الله إلى رسول الله ﷺ فسأله أن يعطيه قميصه أن يكفن فيه أباه فأعطاه ثم سأله أن يصلي عليه فقام رسول الله ﷺ ليصلي عليه فقام عمر فأخذ بثوب رسول الله ﷺ فقال يا رسول الله أتصلي عليه وقد نهاك الله أن تصلي عليه فقال رسول الله ﷺ إنما خيرني الله فقال {استغفر لهم أو لا تستغفر لهم إن تستغفر لهم سبعين مرة} وسأزيد على سبعين قال إنه منافق فصلى عليه رسول الله ﷺ وأنزل الله عز وجل {ولا تصل على أحد منهم مات أبدا ولا تقم على قبره}

مسلم 6207صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Virtues of the Companions, may Allah be pleased with them
Chapter
From the virtues of Umar, may Allah be pleased with him
Numbering
Darussalam 6207
Muslim 6207