A doctor can refuse to see a patient in private practice, the hospital, and the ER, despite what other posters have stated.
In the ER, if the patient is non-emergent, the physician can refuse to treat a patient after they have been given a medical screening. It happens all the time.
In the hospital setting, if the patient is admitted, then there is an attending physician who has assumed responsibility for the patient. While patients have rights, they also have responsibilities. If the patient is non-compliant and uncooperative, the physician can discharge the patient and refuse to treat them further.
If the patient has come through the ER and the ER doc thinks the patient warrants admission, a physician is not obligated to admit the patient.
Doctors in private practice "fire" patients all the time.
I'm sure many situations are more nuanced and that there are regulations and procedures surrounding an MD "firing" a patient, but I don't know much about all that.
Back to the ER, which is something I know a smidge about, an ER doc cannot literally refuse to SEE the patient. A provider must determine if the patient has an emergent condition and a federal regulation known as EMTALA binds the physician (as well as their ethics, hopefully) to provide any care necessary to stabilize the patient. Beyond that, treatment is up to the physician...more or less.
EMTALA is not quite as cut and dry as I made it sound (Although it is pretty straight-forward), but I'm not getting into all the details about it. If you're interested there's a bevy of info on the web.