The baby is an innocent. If the church baptizes babies, it should baptize all of them, because no baby ever does anything that warrants being lost.
The church can always excommunicate later on.
Every Sacrament must have intent--- not perfection, but intent --- to be freed from sin. If intent were not essential, we could just spray water over whole football stadiums of people and baptize them all, couldn't we? It would be as if Baptism was not a sacrament at all, but rather some kind of magic.
Being unbaptized does not damn this child. Unbaptized babies, when they die, are commended to the mercy of God in the rites of the Catholic Church.