Let me elaborate on my previous post:
From the Catechism of the Catholic Church:
Paragraph 1257: ...The Lord himself affirms that Baptism is necessary for salvation (jn 3:5). He also commands his disciples to proclaim the Gospel to all nations and to baptize them (Mt 28: 19-20). Baptism is necessary for salvation for those to whom the Gospel has been proclaimed and who have had the possibility of asking for this sacrament (MK 16:16). The Church does not know of any means other than Baptism that assures entry into eternal beatitude; this is why she takes care not to neglect the mission she has received from the Lord to see that all who can e baptized are 'reborn of water and the Spirit." God has bound salvation to the sacrament of Baptism, but he himself is not bound by his sacraments.
Paragraph 1258: The Church has always held the firm conviction that those who suffer death for the sake of the faith without having received Baptism are baptized by their death for and with Christ. This Baptism of blood, like the desire for Baptism, brings about the fruits of Baptism without being a sacrament.
Paragraph 1259: For catechumens who die before their Baptism, their explicit desire to receive it, together with repentance for their sins, and charity, assures them the salvation that they were not able to receive through the sacrament.
Paragraph 1260: "Since Christ died for all, and since all men are in fact called to one and the same destiny, which is divine, we must hold that the Holy Spirit offers to all the possibility of being made partakers, in a way known to God, of the Paschal mystery." Every man who is ignorant of the Gospel of Christ and of his Church, but seeks the truth and does the will of God in accordance with his understanding of it, can be saved. It may be supposed that such persons would have desired Baptism explicityly if they had known its necessity.