The Catholic Church infallibly teaches the truth that "Outside the Church, there is no salvation." The Church isn't saying here that only Catholics go to Heaven but that all graces needed for salvation originate in Christ and pass through His Mystical Body, the Church.
Section 846 of the Catechism of the Catholic Church affirms that this dogma does mean "All salvation comes from Christ the head through the Church, which is His body."
Those unable to know this truth have what's called invincible ignorance. A little Jewish girl who dies at the age of 6 might be such a person.
Of these, Pope Pius IX in his 1863 encyclical, Quanto Conficiamur Moerore, wrote:
It is known to Us and to you that they who labor in invincible ignorance of our most holy religion and who, zealously keeping the natural law and its precepts engraved in the hearts of all by God, and being ready to obey God, live an honest and upright life, can, by the operating power of divine light and grace, attain eternal life, since God ... will by no means suffer anyone to be punished with eternal torment who has not the guilt of deliberate sin.
As cited in Denzinger §1677, Pius IX adds:
But, the Catholic dogma that no one can be saved outside the Catholic Church is well known; and also that those who are obstinate toward the authority and definitions of the same Church, and who persistently separate themselves from the unity of the Church, and from the Roman Pontiff, the successor of Peter, to whom "the guardianship of the vine has been entrusted by the Savior," cannot obtain eternal salvation.
Vatican II repeats this admonition in Lumen Gentium §14: "Whosoever, therefore, knowing that the Catholic Church was made necessary by Christ, would refuse to enter or to remain in it, could not be saved. ... Not only shall they not be saved but they will be the more severely judged."
To learn more about the Catholic faith, check out the Catholicism series.