In the US and Canada, I addressed my lecturers and instructors as "Professor X", "Dr. X", "Mr. X", or "Ms. X" (depending on their formal education and academic position). I am currently at a university in Southeast Asia where students rarely (almost never) address university staff by name. They will say (always in English), "thank you professor", "thank you doctor", "good morning sir", "good morning miss", etc. There is nothing wrong with this; it's just the academic custom here.
My question is about US and Canadian academia: is it appropriate to address a PhD holder as "doctor" without name? For example, is it appropriate to say "thank you doctor" instead of "thank you Dr. X"? I recall hearing "thank you professor" (without name), but I can't recall hearing "thank you doctor" (without name).