St Thomas Summa Theologiae II-II, Q.5:
Article 3. Whether a man who disbelieves one article of faith, can have lifeless faith in the other articles?
Objection 1. It would seem that a heretic who disbelieves one article of faith, can have lifeless faith in the other articles. For the natural intellect of a heretic is not more able than that of a catholic. Now a catholic's intellect needs the aid of the gift of faith in order to believe any article whatever of faith. Therefore it seems that heretics cannot believe any articles of faith without the gift of lifeless faith.
Objection 2. Further, just as faith contains many articles, so does one science, viz. geometry, contain many conclusions. Now a man may possess the science of geometry as to some geometrical conclusions, and yet be ignorant of other conclusions. Therefore a man can believe some articles of faith without believing the others.
Objection 3. Further, just as man obeys God in believing the articles of faith, so does he also in keeping the commandments of the Law. Now a man can obey some commandments, and disobey others. Therefore he can believe some articles, and disbelieve others.
On the contrary, Just as mortal sin is contrary to charity, so is disbelief in one article of faith contrary to faith. Now charity does not remain in a man after one mortal sin. Therefore neither does faith, after a man disbelieves one article.
I answer that, Neither living nor lifeless faith remains in a heretic who disbelieves one article of faith.
The reason of this is that the species of every habit depends on the formal aspect of the object, without which the species of the habit cannot remain. Now the formal object of faith is the First Truth, as manifested in Holy Writ and the teaching of the Church, which proceeds from the First Truth. Consequently whoever does not adhere, as to an infallible and Divine rule, to the teaching of the Church, which proceeds from the First Truth manifested in Holy Writ, has not the habit of faith, but holds that which is of faith otherwise than by faith. Even so, it is evident that a man whose mind holds a conclusion without knowing how it is proved, has not scientific knowledge, but merely an opinion about it. Now it is manifest that he who adheres to the teaching of the Church, as to an infallible rule, assents to whatever the Church teaches; otherwise, if, of the things taught by the Church, he holds what he chooses to hold, and rejects what he chooses to reject, he no longer adheres to the teaching of the Church as to an infallible rule, but to his own will. Hence it is evident that a heretic who obstinately disbelieves one article of faith, is not prepared to follow the teaching of the Church in all things; but if he is not obstinate, he is no longer in heresy but only in error. Therefore it is clear that such a heretic with regard to one article has no faith in the other articles, but only a kind of opinion in accordance with his own will.
Reply to Objection 1. A heretic does not hold the other articles of faith, about which he does not err, in the same way as one of the faithful does, namely by adhering simply to the Divine Truth, because in order to do so, a man needs the help of the habit of faith; but he holds the things that are of faith, by his own will and judgment.
Reply to Objection 2. The various conclusions of a science have their respective means of demonstration, one of which may be known without another, so that we may know some conclusions of a science without knowing the others. On the other hand faith adheres to all the articles of faith by reason of one mean, viz. on account of the First Truth proposed to us in Scriptures, according to the teaching of the Church who has the right understanding of them. Hence whoever abandons this mean is altogether lacking in faith.
Reply to Objection 3. The various precepts of the Law may be referred either to their respective proximate motives, and thus one can be kept without another; or to their primary motive, which is perfect obedience to God, in which a man fails whenever he breaks one commandment, according to James 2:10: "Whosoever shall . . . offend in one point is become guilty of all."
Never mind Baptism of Desire for the moment. The above question deals with whether anyone who doesn't assent to the doctrines of the Church (regardless of whether they are validly baptized or not) can be said to have divine faith (which St Thomas teaches is necessary for salvation). The answer is no! Only those who profess the Catholic faith have divine faith. All others do not have the motive of faith. We affirm this whenever we make a traditional act of faith. e.g. "O my God, I firmly believe that Thou art one God in three divine persons, Father, Son and Holy Ghost; I believe that Thy divine Son became man and died for our sins, and that He shall come to judge the living and the dead. I believe these and all the truths which the holy Catholic Church teaches, because Thou hast revealed them, Who canst neither deceive nor be deceived. Amen."
So even those validly baptized Protestants who are not guilty of the sin of heresy (because they are invincibly ignorant of the Catholic faith) do not have the divine faith which is necessary for their salvation. It is true that some theologians say that only explicit belief in the Holy Trinity and the Incarnation are necessary and that is true but the motive of faith is also necessary. The person in question may only explicitly know and believe in the doctrines of the Holy Trinity and the Incarnation but they must also have the belief that all that the Catholic Church teaches is from God and must be believed. Without that motive of faith, the person does not possess any faith at all. All of the preceding only applies to those who have the use of reason. Those who do not have the use of reason need only be validly baptized.
Now this doctrine of St Thomas completely obliterates the modernist teaching that Jєωs, Mohammadens and pagans as well as Protestants can be saved by their sincerity in seeking God and their adherence to natural law. Regardless of what you believe concerning BOD of catechumens, it has been the universal teaching of the magisterium as well as Catholic theologians (at least until the mid 19th century) that non-Catholics cannot be saved. St Thomas says it is necessary for salvation for each individual to PROFESS the Catholic faith. Merely having a longing for entrance into the Church is NOT enough. It is absolutely necessary to have the motive of faith and to profess it publicly. The remedy for Original Sin (disbelief in the commandments of God) is belief in all that God has revealed through the Catholic Church. Which includes the doctrine that the Sacrament of Baptism is necessary for salvation.