It sounds like the baby you were talking about had anencephaly. Those babies have a brain but just not a cerebral cortex, where all the thinking goes on. A lot of times the top of their head will be open. Most of the time those babies have the worst types of other deformities too. They often come out to be very ugly. Sometimes they have a small amount of cerebral cortex. It was actually pictures of anencephalic babies that disturbed me the most. They often look like monsters. Because they have a brain stem, they might feel pain even if they don't have the capacity to think and are born blind and deaf.
Thanks for the answer, Chaim. I hope that the babies who die from their deformity or otherwise suffer from them will be comforted and allowed to be healthy and whole in the next world.