Sunan an-Nasa'i, Volume 3, Book 21, Hadith 1901 (DarusSalam)

It was narrated that 'Abdullah bin 'Umar said: "When 'Abdullah bin Ubayy died, his son came to the Prophet and said: 'Give me your shirt so that I may shroud him in it, and (some and) offer the (funeral) prayer for him, and pray for forgiveness for him'. So he gave him his shirt then he said: 'When you have finished, inform me and I will offer the (funeral) prayer for him.' But 'Umar stopped him and said: 'Hasn't Allah forbidden you to offer the (funeral) prayer for the hypocrites?' He said: 'I have two options. Whether you ask forgiveness for them (hypocrites) or ask no forgiveness for them." So he offered the (funeral) prayer for him. Then Allah, Most High, revealed: 'And never pray (funeral prayer) for any of them (hypocrites) who dies, nor stand at his grave.' So he stopped offering the (funeral) prayer for them."

أَخْبَرَنَا عَمْرُو بْنُ عَلِيٍّ، قَالَ حَدَّثَنَا يَحْيَى، قَالَ حَدَّثَنَا عُبَيْدُ اللَّهِ، قَالَ حَدَّثَنَا نَافِعٌ، عَنْ عَبْدِ اللَّهِ بْنِ عُمَرَ، قَالَ لَمَّا مَاتَ عَبْدُ اللَّهِ بْنُ أُبَىٍّ جَاءَ ابْنُهُ إِلَى النَّبِيِّ صلى الله عليه وسلم فَقَالَ أَعْطِنِي قَمِيصَكَ حَتَّى أُكَفِّنَهُ فِيهِ وَصَلِّ عَلَيْهِ وَاسْتَغْفِرْ لَهُ ‏.‏ فَأَعْطَاهُ قَمِيصَهُ ثُمَّ قَالَ ‏"‏ إِذَا فَرَغْتُمْ فَآذِنُونِي أُصَلِّي عَلَيْهِ ‏"‏ ‏.‏ فَجَذَبَهُ عُمَرُ وَقَالَ قَدْ نَهَاكَ اللَّهُ أَنْ تُصَلِّيَ عَلَى الْمُنَافِقِينَ ‏.‏ فَقَالَ ‏"‏ أَنَا بَيْنَ خِيرَتَيْنِ ‏"‏ ‏.‏ قَالَ ‏{‏ اسْتَغْفِرْ لَهُمْ أَوْ لاَ تَسْتَغْفِرْ لَهُمْ ‏}‏ فَصَلَّى عَلَيْهِ فَأَنْزَلَ اللَّهُ تَعَالَى ‏{‏ وَلاَ تُصَلِّ عَلَى أَحَدٍ مِنْهُمْ مَاتَ أَبَدًا وَلاَ تَقُمْ عَلَى قَبْرِهِ ‏}‏ فَتَرَكَ الصَّلاَةَ عَلَيْهِمْ ‏.‏

sunnah.com