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 to shroud his father in. He gave it to him. Then he asked him to pray over him, and the Messenger of Allah ﷺ rose to pray over him. Umar stood up 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. If you ask forgiveness for them seventy times' [Tawbah 9:80], and I shall ask more than seventy times."Umar said, "But he is a hypocrite!"Still, the Messenger of Allah ﷺ prayed over him, so Allah عز وجل revealed, "And never pray over any of them who has died, nor stand at his grave" [Tawbah 9:84].The narrator added, "So he stopped praying over them."

Muslim 7028

Sahih

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

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