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 he could shroud his father in it, and he gave it to him. Then he asked him to pray over him, so the Messenger of Allah ﷺ stood up to pray over him.Umar stood up and took hold of the Messenger of Allah's ﷺ garment 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. If you ask forgiveness for them seventy times' [Tawbah 9:80], and I will add 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 7027

Sahih

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

عن ابن عمر قال

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

مسلم 7027صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Characteristics of the hypocrites and their rulings
Chapter
Characteristics of the hypocrites and their rulings
Numbering
Darussalam 7027
Muslim 7027