كتاب الإيمان
1  
The Book of Faith
(27)
Chapter: Clarifying the condition of the fath of one who knowingly denies his father
(27)
باب بَيَانِ حَالِ إِيمَانِ مَنْ رَغِبَ عَنْ أَبِيهِ وَهُوَ يَعْلَمُ ‏‏
Sahih Muslim 63 a

It is reported on the authority of Sa'd b. Abi Waqqas:

Both of my ears heard the Messenger of Allah saying this: He who claimed the fatherhood of anyone else besides his real father knowingly (committed a great sin) ;Paradise is forbidden to him. Abu Bakra asserted that he too heard it from the Messenger of Allah (may peace be upon him ).
حَدَّثَنِي عَمْرٌو النَّاقِدُ، حَدَّثَنَا هُشَيْمُ بْنُ بَشِيرٍ، أَخْبَرَنَا خَالِدٌ، عَنْ أَبِي عُثْمَانَ، قَالَ لَمَّا ادُّعِيَ زِيَادٌ لَقِيتُ أَبَا بَكْرَةَ فَقُلْتُ لَهُ مَا هَذَا الَّذِي صَنَعْتُمْ إِنِّي سَمِعْتُ سَعْدَ بْنَ أَبِي وَقَّاصٍ يَقُولُ سَمِعَ أُذُنَاىَ مِنْ رَسُولِ اللَّهِ صلى الله عليه وسلم وَهُوَ يَقُولُ ‏ "‏ مَنِ ادَّعَى أَبًا فِي الإِسْلاَمِ غَيْرَ أَبِيهِ يَعْلَمُ أَنَّهُ غَيْرُ أَبِيهِ فَالْجَنَّةُ عَلَيْهِ حَرَامٌ ‏"‏ ‏.‏ فَقَالَ أَبُو بَكْرَةَ وَأَنَا سَمِعْتُهُ مِنْ رَسُولِ اللَّهِ صلى الله عليه وسلم ‏.‏
Reference : Sahih Muslim 63a
In-book reference : Book 1, Hadith 125
USC-MSA web (English) reference : Book 1, Hadith 120
  (deprecated numbering scheme)