And the third case only applies if you have the invisible condition before combat starts.
As for your scenario, I addressed that earlier. If you are in combat and walk past the guards, they see you do that. You may become invisible to them again if you break line of site, but that doesn't...