There is no salvation outside of Christ, and the Church is the Bride of Christ -- become His Body, one Flesh in marriage.
Therefore, there is no salvation outside of the Church and not belonging formally to the Catholic Church is objectively sinful:
Matthew 18:17
"If he will not hear the Church, let him be to thee as a heathen and a publican"
Luke 10:16
"He that heareth you heareth Me, and he that despiseth you despiseth Me, and he that despiseth Me, despiseth Him that sent Me"
Mark 16:16
"He that believeth not will be condemned"
John 3:18
"He that believeth not is already judged"
Luke 11:23
"He that is not with Me is against Me and he that gathereth not with Me, scattereth"
This does not mean, however, that if one is necessarily damned if one is not a formal member of the visible society of God's Kingdom on earth -- the One, Holy, Catholic and Apostolic Church.
What it means is that: Christ founded one Church with Peter as His Vicar; that this Church was given the powers of binding and loosing, that this Church exists today; that it is the source of the Gospel and the earthly source of the Sacraments without which, normatively, one cannot be saved. Those who are not formal members might be saved and become associated with the soul of the Church if they:
are validly baptized by water and spirit, in the Name of the Father, and of the Son, and of the Holy Ghost (all who are baptized are subject to the Church even if they are not formal members because Baptism belongs to the Church), and
have not committed a mortal sin (or who, if they have committed a mortal sin, have made a perfect act of contrition), which means a sin concerning a grave matter committed with full knowledge and consent of the will, and
are animated by charity and a supernatural Faith in God's existence, and
seek Him, and
- firmly believe that their religion is the true religion such that there is no conflict or doubt about such in their ill-formed conscience, and
-are not formally outside of the Church in spite of doubts about the possibility that the Catholic Church is the true Church of Christ (if one believes it is possible that the Catholic Church is the true Church of Christ, one is duty-bound to investigate)
In addition, those individuals who, through no fault of their own, have no means to hear of Christ-given Baptism and are invincibly ignorant -- who've never heard the Name Jesus, know nothing of the Church, or misunderstand Church teachings -- but who obey the Natural Law written in all men's hearts and who truly seek God are left to the mercy of Christ Who may save them as He desires.
Christ will judge our wills, hearts, intellects, and deeds, and shall have mercy and compassion on whom He will have mercy and compassion (Romans 9:15); those whom He deigns to save He can well give the grace of the Sacraments to in a manner beyond our ken -- perhaps even in their final breath, by illuminating their souls in a supernatural way such that they desire Baptism, even if implicitly, and therefore become associated with the Soul of the Catholic Church, outside of which there is no salvation.
This is something we can never presume -- but we can pray for.
I note here, too, that there is also the possibility of Limbo -- a state of perfect natural happiness -- for those who die unregenerated (unbaptized) and with the stain of original sin, but who've committed no personal sin. While these people would not enter Heaven as they are not born again of water and Spirit (or the desire for it), they would also experience no subjective sufferings. This teaching is not a part of revelation and is, therefore, not a matter of dogma. There is no consensus among the Church Fathers on the matter; some believed in the existence of Limbo (e.g., most of the Greek Fathers, St. Augustine in his early writings, St. Gregory Nanzianus, St. Ambrose, St. Thomas Aquinas) while others didn't (e.g., St. Augustine in his later writings, St. Anselm). But it is a most definite possibility that can be piously believed given the truths that God is not only merciful but just and, therefore, will not punish someone for that which involves no personal guilt. While believing this proposition, which is the prevalent belief among traditional Catholics, one must never forget how easy it is to sin -- and that most everyone who's reached the age of reason has (in fact, because of the rarity of those who've reached the age of reason and have not committed personal sins, "Limbo" is often referred to as "Children's Limbo.")
These possibilities are left to the mercy of God, however, and the presumption of salvation in any sense on the part of anyone who is not a formal member of the the visible Church is a sin against the Holy Spirit. We can pray for such, but we cannot presume such. We cannot presume this association with the Soul of the Church on the part of any particular individual who is not a manifest member the Church; in fact, we are to presume the opposite because they are objectively in sin, even if not culpably so, and we must do all we can to bring them to the Sacraments, which are true media of grace. We are to preach the fullness of the Truth, pray for God's mercy on all who are apart from the Sacraments, and always remember that material heresy is still heresy, no matter the level of culpability a material heretic might possess. While some who are not formal members of the Churchmight be illumined before death such that they desire Baptism and are then allowed to see Heaven by the Grace of Christ and become, therefore, associated with the Soul of the Church, the non-Catholic elements of other religions do not mediate grace in and of themselves, and it is always God's will that all formally become part of the eternally unified Mystical Body of Christ. The salvation of these souls would be in spite of, not because of, their religion.
In this regard, any "ecumenism" that is not false will have as its goal the bringing of all into the Church as formal members, be they Protestant, Jewish, Buddhist, Muslim, Hindu, pagan, or secular. The goal of any true "ecumenism" isn't "unity" because the Church is already unified; His Body is already unified. The return of heretics, schismatics, and apostates to the bosom of the One, Holy, Catholic and Apostolic Catholic Church is the only goal of true ecumenism.
The proper attitude to take toward the Truth that those who are not formal members of the Church might be saved if they meet the above criteria is expressed well in this analogy by Harold E. Welitz:
Let's say that a father kept a loaded gun in the house. Now, certainly it has occurred since the invention of the revolver that a bullet has failed to fire when the trigger was pulled. Therefore, based on this possibility should the father continually remind his children that if they play with a gun and shoot at each other, it may not go off? Would that be a wise and prudent father, one who truly cares for his children? If the father continually discussed the possibility that the gun may not go off if the trigger were pulled, would he be misleading his children? Yes! Although what he is saying is not false, it is deceptive because it implies that something that is rare is actually likely. The result will be that the children will become more negligent in playing with loaded guns, which most likely will kill one of them. Should the father not say: "Do not play with a loaded gun, whatever you do! If you play with a loaded gun, someone will get killed." A wise and prudent father may realize there are a very slight percentage of bullets that are defective, but he knows it is not wise to continually remind his children of this, lest they become forgetful of the dangers of playing with loaded guns.
To carry the metaphor further: Catholics don't let non-Catholics play with guns. When others do play with guns, we can pray and have human hope that they don't get shot, but we can't expect or have a "good hope" that they won't. If, in fact, they are not "shot," we know that they are a part of the Church outside of which there is no salvation.
Bottom line: We can't know the subjective states of the souls of manifest heretics, and we can't know how God might or might not illumine the the souls of the invincibly ignorant. But we can and do know what He has revealed about Himself, and we must tell others this Gospel. We can and do know what He told us about His Church, and we must bring people to it. We can and do know what He told us to do, and we must do it. And we must do these things with firmness, boldness, prudence, and great charity, all while begging mercy for sinners, including ourselves.
( source and courtesy Fish Eaters - Catholicism 101 - A brief primer )