This is X-Files episode 11 of the ninth season, Audrey Pauley.
After driving home from work, Monica Reyes (Annabeth Gish) is struck by a drunk driver and transported to a hospital, where she is examined by Dr. Preijers (Jack Blessing) and Nurse Edwards; she soon slips into a coma. Reyes, however, wakes up moments later in the same room all alone. Running to the door, she discovers that the hospital is floating in a dark void. She soon finds two other patients, Stephen Murdoch (Stan Shaw), and Mr. Barreiro (Del Zamora). They assume that they are dead. Reyes, however, maintains that they are still alive.
Meanwhile, Dana Scully (Gillian Anderson) tells John Doggett (Robert Patrick) that Reyes is braindead, a fact that Doggett refuses to believe. Preijers informs Doggett and Scully that, since Reyes was an organ donor, in a few days her life-support will be pulled and the hospital will harvest her remains. In the floating hospital, Reyes sees a woman (Tracey Ellis) standing in the hallway, but she disappears. At that moment, Barreiro begins screaming and is engulfed in blue electricity before disappearing. In the real world, it is revealed that Barreiro, a fellow comatose patient, has had his life support removed by Preijers. Nearby stands the mystery woman that Reyes encountered: Audrey Pauley.
Doggett begins looking into ways to save Reyes, noting an anomaly in her electrocardiograph that suggests stifled brain activity. While visiting her room, Doggett runs into Audrey who tells her that Reyes' soul is not gone yet. Audrey walks to her room in the basement, where a model of the hospital has been built. By concentrating her mind, she is able to move into the floating hospital where Reyes is trapped. Once there, she finds Reyes and asks her to tell Doggett that he's a "dog person", a reference to a conversation the two had before Reyes' crash. After relaying the message, Doggett is determined that Reyes is not gone and, following Audrey, learns about her hospital model.
Meanwhile, Nurse Edwards (Vernee Watson-Johnson) confronts Preijers about an injection she saw him give Reyes; he kills Edwards to cover his tracks. Later, in the floating hospital, Stephen collapses and disappears when he too is pulled off of life support. After Doggett is spotted with Audrey in the basement by Preijers, he begins to worry that she could expose what he is doing. He injects the same drug he used to kill Edwards, but Audrey is able to concentrate and move into the floating hospital one last time. She informs Reyes that her only way out is to jump into the void. Reyes does so and wakes up in her hospital bed moments before her organs are to be harvested. Doggett runs down to Audrey's room only to find that Preijers has killed her. Doggett manages to capture Preijers before he can escape
FWIW, the way in which I found it was doing a Google search for TV series model hospital
. The episode was mentioned on the first page.