What do we mean when we say, "Outside the Church there is no salvation?" When we say, "Outside the Church there is no salvation," we mean that Christ made the Catholic Church a necessary means of salvation and commanded all to enter it, so that a person must be connected with the Church in some way to be saved.
How can persons who are not members of the Catholic Church be saved? Persons who are not members of the Catholic Church can be saved if, through no fault of their own, they do not know that the Catholic Church is the true Church, but they love God and try to do His will, for in this way they are connected with the Church by desire.
Further reading: CCC 839-848