Sayyiduna Abu Sa'id al-Khudri (may Allah be pleased with him) relates that the Prophet (peace and blessings be upon him) said: "The one who died during the interval between prophets (fatrah), the insane person and the one who died in infancy will be brought. The one who died during the interval will say: 'Neither a Book nor a messenger came to me.' The insane person will say: 'O my Lord, You did not give me any intellect by which I could understand good or evil.' The one who died in infancy (the child) will say: 'I did not live to the age of deeds.'" The Prophet (peace and blessings be upon him) said: "Then a fire will be raised before them, and it will be said to them: 'Enter it!' Then whoever, in the knowledge of Allah Almighty, would have been fortunate had he had the chance to act, will enter it; and whoever, in the knowledge of Allah Almighty, would have been wretched had he had the chance to act, will hold back from entering it. Then Allah Almighty will say: 'You are disobeying Me; then what would you have done with My messengers in the unseen?'"
Al-Bazzar recorded it; its chain contains Atiyyah, who is da'if (weak).
Hadith Referenceمجمع الزوائد ومنبع الفوائد / كتاب القدر / 11938