"For children baptized before coming to the use of reason, afterwards when they come to perfect age, might easily be persuaded by their parents to renounce what they had unknowingly embraced; and this would be detrimental to the faith." (Summa Theologica, IIa IIae, q.10, a.12)
So, clearly, even if the Pope were (or is) espousing heretical and/or approximate to heretical ideas, we have both a right and a duty to resist him. In this respect, we are submitting to him, if only for the salvation of his immortal soul (and ours.) Saint Thomas continues,
“There being an imminent danger for the Faith, prelates must be questioned, even publicly, by their subjects. Thus, St. Paul, who was a subject of St. Peter, questioned him publicly on account of an imminent danger of scandal in a matter of Faith. And, as the Glossa of St. Augustine puts it (Ad Galatas 2.14), 'St. Peter himself gave the example to those who govern so that if sometimes they stray from the right way, they will not reject a correction as unworthy even if it comes from their subjects.” (Summa Theologica, IIa IIae, q.33, a.4)
“It is written: ‘We ought to obey God rather than men.’ Now sometimes the things commanded by a superior are against God. Therefore, superiors are not to be obeyed in all things.” (Summa Theologica, IIa IIae, q.104, a.5)
Cum ex Apostolatus Officio
Pope Paul IV, speaking with the infallible authority of divine law stated the following:
In assessing Our duty and the situation now prevailing, We have been weighed upon by the thought that a matter of this kind [i.e. error in respect of the Faith] is so grave and so dangerous that the Roman Pontiff,who is the representative upon earth of God and our God and Lord Jesus Christ, who holds the fulness of power over peoples and kingdoms, who may judge all and be judged by none in this world, may nonetheless be contradicted if he be found to have deviated from the Faith. Remembering also that, where danger is greater, it must more fully and more diligently be counteracted, We have been concerned lest false prophets or others, even if they have only secular jurisdiction, should wretchedly ensnare the souls of the simple, and drag with them into perdition, destruction and damnation countless peoples committed to their care and rule, either in spiritual or in temporal matters; and We have been concerned also lest it may befall Us to see the abomination of desolation, which was spoken of by the prophet Daniel, in the holy place. In view of this, Our desire has been to fulfill our Pastoral duty, insofar as, with the help of God, We are able, so as to arrest the foxes who are occupying themselves in the destruction of the vineyard of the Lord and to keep the wolves from the sheepfolds, lest We seem to be dumb watchdogs that cannot bark and lest We perish with the wicked husbandman and be compared with the hireling. (Cum ex Apostolatus Officio, 1)In short, we do not owe any obedience to a heretical Pope (or to a Pope who refuses to condemn heretical beliefs) any more than an American citizen owes obedience to a traitorous President.
Vatican 1 -- The Purpose
For the Holy Spirit was promised to the successors of Peter not so that they might, by his revelation, make known some new doctrine, but that, by his assistance, they might religiously guard and faithfully expound the revelation or deposit of faith transmitted by the apostles.
Vatican 1 -- The Promise
Indeed, their apostolic teaching was embraced by all the venerable fathers and reverenced and followed by all the holy orthodox doctors, for they knew very well that this See of Peter always remains unblemished by any error, in accordance with the divine promise of our Lord and Savior to the prince of his disciples: I have prayed for you that your faith may not fail; and when you have turned again, strengthen your brethren
This gift of truth and never-failing faith was therefore divinely conferred on Peter and his successors in this See so that they might discharge their exalted office for the salvation of all, and so that the whole flock of Christ might be kept away by them from the poisonous food of error and be nourished with the sustenance of heavenly doctrine. Thus the tendency to schism is removed and the whole Church is preserved in unity, and, resting on its foundation, can stand firm against the gates of hell.