A simple rule of thumb is to begin by addressing the person as the gender they are presenting. If he’s wearing a dress and attempting to appear feminine, address him as “she”, “ma’am”, “her” etc. If she’s wearing obvious male garb and making an effort to appear male, address her as “sir”, “he” etc. If it’s really unclear or ambiguous, a polite “I’m unsure how I should address you; what would you prefer?” will usually clear things up.