We are bound to obey, and not reject, the authority of the Church in matters of the faith and moral teachings. However, this does not mean everything ordered by those within the hierarchy of the Church should be obeyed. St. Thomas Aquinas has given us a brief treatise on true obedience, false obedience, and disobedience: catholicapologetics.info/modernproblems/vatican2/obediance.htm
In Summa Theologica, Q.33 Art 4, St. Thomas Aquinas makes it clear that we are bound to correct even his superior saying "if the faith is endangered a subject ought to rebuke his prelate even publicly. Hence Paul, who was Peter’s subject, rebuked him in public, on account of the imminent danger of scandal concerning the faith, and, as the gloss of Augustine says on Gal. 2:11: “Peter gave an example to superiors that if at any time they should happen to stray from the straight path, they should not disdain to be reproved by their subjects”.
We become obedient to the Church and her officials only when we become obedient to the constant teaching of the church as taught by the Magisterium throughout the ages. If what is taught by an appointed servants of God (bishop, priest or Pope) is contrary to Catholic teaching then they are Not to be obeyed but even publicly rebuked (Titus 1:10) as they no longer speak on behalf of church but become representatives of their own novelty.
“By your stubbornness and impenitent heart, you are storing up wrath for yourself for the day of wrath and revelation of the just judgment of God, who will repay everyone according to his works: eternal life to those who seek glory, honor, and immortality through perseverance in good works, but wrath and fury to those who selfishly disobey the truth and obey wickedness.” (Rom. 2:5-8)
“Let every person be subordinate to the higher authorities, for there is no authority except from God, and those that exist have been established by God. Therefore, whoever resists authority opposes what God has appointed, and those who oppose it will bring judgment upon themselves. For rulers are not a cause of fear to good conduct, but to evil. Do you wish to have no fear of authority? Then do what is good and you will receive approval from it, for it is a servant of God for your good. But if you do evil, be afraid, for it does not bear the sword without purpose; it is the servant of God to inflict wrath on the evildoer. Therefore, it is necessary to be subject not only because of the wrath but also because of conscience. This is why you also pay taxes, for the authorities are ministers of God, devoting themselves to this very thing. Pay to all their dues, taxes to whom taxes are due, toll to whom toll is due, respect to whom respect is due, honor to whom honor is due.” (Rom. 13:1-7)
“It is right to submit to a higher authority whenever a command of God would not be violated.” (St. Basil the Great, Doctor of the Church)
“…interior obedience…is the true obedience of an orthodox man” (Pope Clement XI, “Vineam Domini Sabaoth”, 1705 A.D.)
“[O]bedience in this case [of things contrary to God] would be unlawful.” (St. Thomas Aquinas, Doctor of the Church and “greatest theologian in the history of the Church”)
It is written (Acts 5:29): ‘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." (St. Thomas Aquinas, Doctor of the Church and “greatest theologian in the history of the Church”)
“[W]e may distinguish a threefold obedience; one, sufficient for salvation, and consisting in obeying when one is bound to obey: secondly, perfect obedience, which obeys in all things lawful: thirdly, indiscreet obedience, which obeys even in matters unlawful.” (St. Thomas Aquinas, Doctor of the Church and “greatest theologian in the history of the Church”)
(these citations are listed here: mycatholicsource.com/mcs/qt/catholic_life_reflections_obedience_disobedience.htm)