كتاب البر والصلة والآداب
45
The Book of Virtue, Enjoining Good Manners, and Joining of the Ties of Kinship
(39)
Chapter: The Prohibition Of Making Others Despair Of The Mercy Of Allah
(39)
باب النَّهْىِ عَنْ تَقْنِيطِ الإِنْسَانِ، مِنْ رَحْمَةِ اللَّهِ تَعَالَى ‏ ‏

Jundub reported that Allah's Messenger (ﷺ) stated that a person said:

Allah would not forgive such and such (person). Thereupon Allah the Exalted and Glorious, said: Who is he who adjures about Me that I would not grant pardon to so and so; I have granted pardon to so and so and blotted out his deeds (who took an oath that I would not grant pardon to him).
حَدَّثَنَا سُوَيْدُ بْنُ سَعِيدٍ، عَنْ مُعْتَمِرِ بْنِ سُلَيْمَانَ، عَنْ أَبِيهِ، حَدَّثَنَا أَبُو عِمْرَانَ الْجَوْنِيُّ، عَنْ جُنْدَبٍ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم حَدَّثَ ‏ "‏ أَنَّ رَجُلاً قَالَ وَاللَّهِ لاَ يَغْفِرُ اللَّهُ لِفُلاَنٍ وَإِنَّ اللَّهَ تَعَالَى قَالَ مَنْ ذَا الَّذِي يَتَأَلَّى عَلَىَّ أَنْ لاَ أَغْفِرَ لِفُلاَنٍ فَإِنِّي قَدْ غَفَرْتُ لِفُلاَنٍ وَأَحْبَطْتُ عَمَلَكَ ‏"‏ ‏.‏ أَوْ كَمَا قَالَ ‏.‏
Reference : Sahih Muslim 2621
In-book reference : Book 45, Hadith 178
USC-MSA web (English) reference : Book 32, Hadith 6350
  (deprecated numbering scheme)