The Catholic Church teaches that "The Lord himself affirms that Baptism is necessary for salvation" (CCC 1257). When most people hear that teaching, they immediately think of all the unbaptized individuals in the world.
It would appear that God is unjust and harsh, dooming so many people to Hell who do not have access to the sacrament of baptism.
Yet, the Church has taught for centuries that baptism can include 3 different "types."
1Baptism of Water
The "ordinary" type of baptism is the one we are all most familiar with.
This type of baptism follows Jesus' example in the Gospel and is the sacramental way to be immersed into the life of grace.
Baptism by water doesn't guarantee a ticket to Heaven, but it does lay the foundation of grace that all Christians can either accept or reject. If we accept it, then God will guide us along the right path and into his loving arms.
2Baptism of Desire
This second type of baptism is the most confusing and also the one most open to interpretation.
The most obvious example of this desire is when a person is on the road to baptism, but is unable to finish it.
However, this also includes anyone who may have "desired" baptism, even if they never knew what the sacrament was.
This is type of baptism is the most encompassing, for it includes anyone who would have desired baptism, "if they truly knew its importance." Ultimately it comes down to God's mercy and his determination on how well that individual followed the path laid out for him.
The key here is that the individual did not know the importance of baptism.
3Baptism of Blood
After baptism of water, this type of baptism is the most obvious. Basically, it is when an unbaptized person dies for the Christian faith.
If you die for Christ, but are not a "Christian," than you most assuredly are "baptized."