Sayyiduna Abdullah bin Umar (may Allah be pleased with him) said: When Abdullah bin Ubayy died, his son came to the Prophet (peace and blessings be upon him) and said: Give me your shirt so that I may shroud him in it, and that you pray over him and ask forgiveness for my father. He (peace and blessings be upon him) gave him his shirt and said: "When you have finished with the shrouding, let me know." When he intended to pray, Sayyiduna Umar (may Allah be pleased with him) said: O Messenger of Allah! Have you not been forbidden from praying over a hypocrite? He (peace and blessings be upon him) said: "I have been given the choice: 'Ask forgiveness for them or do not ask forgiveness for them' [Surah al-Tawbah: 80]." So he (peace and blessings be upon him) prayed over him, and then this verse was revealed: "And do not ever pray over any of them who has died, nor stand at his grave" [Surah al-Tawbah: 84]. So he (peace and blessings be upon him) gave up praying (over them).
Hadith Referenceالسنن الكبرى للبيهقي / كتاب المرتد / 16842