They can't. That's the problem - there's little you can do to stop it from happening, even if you're aware of this sort of billing problem and try to take steps to prevent it.
https://www.npr.org/sections/health-shots/2018/08/27/6408918...
> Surprise bills occur when a patient goes to a hospital in his insurance network but receives treatment from a doctor who does not participate in the network, resulting in a direct bill to the patient. They can also occur in cases like Calver's, where insurers will pay for needed emergency care at the closest hospital — even if it is out of network — but the hospital and the insurer may not agree on a reasonable price. The hospital then demands that patients pay the difference, in a practice called balance billing.
https://www.npr.org/sections/health-shots/2015/02/17/3869088...
> The surgeon's office later told her that he belonged to two different medical groups. One was in Morgan's husband's health plan network, the other wasn't.
I got this one, it was mindblowing. For ER work, they'd bill through one practice, for scheduled appointments, another.
I got balance billed for $11k. My father, who worked in employee benefits for over 30 years, couldn't even figure out what was up at first. Then they filed to send me to collections because I kept refusing to pay (note, I'm in California and this billing is illegal for life-threatening emergency visits matching the situation I was in). Finally, the insurance company stepped in and covered me, but we were only able to achieve this because my family knew people personally at the insurer.
All kinds of messed up.