When Abdullah died, his son Abdullah bin Abdullah came to the Messenger of Allah ﷺ and asked him for his shirt so that he might shroud his father in it, and he gave it to him. Then he asked him to pray over him, and the Messenger of Allah ﷺ rose to pray.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 your Lord 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, Allah will never forgive them, because they disbelieved in Allah and His Messenger, and Allah does not guide the rebellious people' [Tawbah 9:80]. And I will add more than seventy."Umar said, "But he is a hypocrite."The narrator continued, So the Messenger of Allah ﷺ prayed over him, and Allah revealed, "And never pray over any of them who dies, nor stand at his grave" [Surah Tawbah 9:84].
لما توفي عبد الله، جاء ابنه عبد الله بن عبد الله إلى رسول الله ﷺ فسأله أن يعطيه قميصه يكفن فيه أباه، فأعطاه، ثم سأله أن يصلي عليه، فقام رسول الله ﷺ ليصلي، فقام عمر، فأخذ بثوب رسول الله ﷺ: فقال: يا رسول الله! تصلي عليه وقد نهاك ربك أن تصلي عليه؟ فقال رسول الله ﷺ: إنما خيرني الله، فقال: {استغفر لهم أو لا تستغفر لهم إن تستغفر لهم سبعين مرة فلن يغفر الله لهم ذلك بأنهم كفروا بالله ورسوله والله لا يهدى القوم الفاسقين} وسأزيده على السبعين. قال: إنه منافق. قال: فصلى عليه رسول الله ﷺ فأنزل الله {ولا تصل على أحد منهم مات أبدا ولا تقم على قبره} [سورة التوبة: ٨٤].
Bukhari related it in the tafsir (4670), and Muslim in the merits of the companions (2400), both of them through Abu Usama, who said, Ubaydullah told us, from Nafi, from Ibn Umar, who said, then he mentioned it. The wording given is Bukhari's, and Muslim's wording is similar.