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 for his shirt so that he might shroud his father in it. The Prophet gave it to him. Then he asked him to pray over his father, and the Messenger of Allah ﷺ rose to pray over him.Umar stood up, 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 shall add more than seventy."Umar said, "But he is a hypocrite."Still, 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].This carries the same meaning as the hadith of Abu Usama, with the addition, "So he stopped praying over them."

Muslim 6208

Sahih

و حدثناه محمد بن المثنى وعبيد الله بن سعيد قالا حدثنا يحيى وهو القطان عن عبيد الله بهذا الإسناد في معنى حديث أبي أسامة وزاد قال فترك الصلاة عليهم

مسلم 6208صحيح
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 6208
Muslim 6208