It is narrated from Sayyiduna Abdullah bin Umar (may Allah be pleased with them both) that he offered the funeral prayer over a newborn child in the house itself, then sent it off (for burial) and it was buried. (The narrator of the hadith, Ubaydullah, says:) I asked Nafi': Had the child cried out at birth? He replied: I do not know.
The chain of this narration is sahih (authentic).
Hadith Referenceالمطالب العالية بزوائد المسانيد الثمانية / كتاب الجنائز / 872
Hadith Gradingمحدثین:إسناده صحيح
Hadith Takhrij«حکم الحدیث المطالب العالیہ محققاً تنسیق د. سعد بن ناصر بن عبد العزيز الشَّثري- مکتبہ شاملہ :قال ابن حجر: هَذَا إِسْنَادٌ صَحِيحٌ . » «أورده ابن حجر فى "المطالب العالية"، 872، وأخرجه عبد الرزاق فى «مصنفه» برقم: 6600، وأخرجه الطحاوي فى «شرح معاني الآثار» برقم: 2903»
It is narrated from Maymun bin Mihran that he was with Sayyiduna Abdullah bin Umar (may Allah be pleased with them both) at a funeral when the people present began whispering among themselves that this was a child of zina (an illegitimate child). Meanwhile someone said that it is well known about such a person that he is the worst of the three. When this reached Sayyiduna Abdullah bin Umar (may Allah be pleased with them both), he rejected this notion, saying: "Certainly not; rather, he is the best of the three."
Clarification: The imams and commentators explain that the child is better than his fornicating parents because he is free and innocent of the intention of sin and of that shameful act, and the universal principle of the pure Shari'ah, 'And no bearer of burdens will bear the burden of another' (Surah Fatir: 18), makes it perfectly clear that no soul is made to bear the burden of another's sins.
Hadith Referenceالمطالب العالية بزوائد المسانيد الثمانية / كتاب الجنائز / 873
Hadith Gradingمحدثین:إسناده ضعيف
Hadith Takhrij«حکم الحدیث المطالب العالیہ محققاً تنسیق د. سعد بن ناصر بن عبد العزيز الشَّثري- مکتبہ شاملہ :إسناده معلول. » «أورده ابن حجر فى "المطالب العالية"، 873، وأخرجه عبد الرزاق فى «مصنفه» برقم: 6625، 13862، وأخرجه ابن أبى شيبة فى «مصنفه» برقم: 11733»
Imam Ahmad bin Mani' (may Allah have mercy on him) relates that it is narrated from Sayyiduna al-Nu'man bin Bashir (may Allah be pleased with them both) that the Messenger of Allah (peace and blessings be upon him) led the funeral prayer of a woman who had died in the state of nifas after giving birth as a result of zina, and he (peace and blessings be upon him) also offered the funeral prayer over that child of hers.
Hadith Referenceالمطالب العالية بزوائد المسانيد الثمانية / كتاب الجنائز / 874
Hadith Gradingمحدثین:إسناده صحيح، موقوف
Hadith Takhrij«حکم الحدیث المطالب العالیہ محققاً تنسیق د. سعد بن ناصر بن عبد العزيز الشَّثري- مکتبہ شاملہ :موقوف صحيح. » «أخرجه صحيح البخاري برقم: 325، وأخرجه صحيح مسلم برقم: 964، وأخرجه سنن الترمذي برقم: 1035، وأخرجه سنن النسائي برقم: 1976، 1979، وأخرجه سنن أبي داود برقم: 3195، وأخرجه سنن ابن ماجه برقم: 1493، وأخرجه مسند أحمد برقم: 19649، 19701، وأخرجه المعجم الكبير للطبراني برقم: 6763، 6764، 6765، وأخرجه المعجم الأوسط للطبراني برقم: 2142، وأخرجه رياض الصالحين برقم: 383، وأخرجه الأوسط في السنن والإجماع والاختلاف برقم: 3100، وأخرجه إتحاف الخيرة المهرة بزوائد المسانيد العشرة برقم: 1927»