One thing to consider about the whole respect legitimate authority is that it does not specifically state a paladin has to obey the legitimate authority. To me this gives the paladin a little more wiggle room then most people think. If they code requires a paladin to obey any order from a legitimate authority it would say obey, not respect.
If obeying the legitimate authority does not break any other parts of the paladin’s code then they would be bound to obey it. If obeying the legitimate authority would cause the paladin to break the code, including any alignment restrictions they are free to disobey that authority. Depending on the circumstance the paladin may have limits to what he can do, but they don’t need to blindly follow orders just because someone is the ruler of a kingdom.
One example would be if a king orders a paladin who is sworn loyalty to him to lie in court. In this case the paladin could disobey the king and tell the truth. He would not start cussing out the king and calling him a lying bastard (even if he is), but would tell the truth.