"Thus came the voice of the Lord unto me, saying: All who have died without a knowledge of this gospel, who would have received it if they had been permitted to tarry, shall be heirs of the celestial kingdom of God;
Also all that shall die henceforth with a knowledge of it, who would have received it with all their hearts, shall be heirs of that kingdom;
For I, the Lord, will judge all men according to their works, according to the desire of their hearts."
Not all the visions that Joseph Smith received are in the Doctrine and Covenants. This one was added later to the scriptures. When this vision of the celestial kingdom was opened up Joseph saw his brother Alvin there. He wondered how that could be when he had died prior to receiving the ordinance of baptism. As I pondered on this I thought of the scripture that every knee will bow and tongue confess that Jesus is the Christ. Which would make me conclude that we would know his judgments are just. That no opportunity to receive His gospel had been denied any one of us. The gospel plan is just and fair for all of God's children. He will know our doings and intents of our hearts and judge us based upon them.