Dr. Miranda Grey (Halle Berry) is a psychiatrist who works at the women's ward of the Woodward Penitentiary, and has a car accident after trying to avoid hitting a girl standing in the middle of the road during a stormy night. She rushes to try to help the girl. Miranda wakes up as a patient in the hospital where she works, and receives treatment from her colleague, Dr. Pete Graham (Robert Downey Jr.). Drugged and confused, Miranda has no memory of what happened after the car accident.
She is horrified to learn that her husband, Douglas (Charles S. Dutton), was brutally murdered and that she is the prime suspect. Miranda heartily denies her involvement in the attack, though she continues to be accused of the murder, even by her husband's best friend, Sheriff Bob Ryan (John Carroll Lynch), who verbally assaults Miranda and demands to know why she killed her husband. While Miranda copes with life in the hospital, She sees the girl from the road who at one point carves the words "Not Alone" into Miranda's arm, which leads her former colleagues to believe Miranda is suicidal and is inflicting the wounds on herself.
As a patient, Miranda bonds with fellow inmate and her own former patient, Chloe Sava (Penélope Cruz). Several times in sessions with Miranda, Chloe claimed that she'd been raped while in the hospital, but she had always attributed these stories to mental illness. One night, the door to Miranda's room in the hospital is opened. When she passes Chloe's room in the hospital, she can hear the rape occurring, and momentarily sees a man's chest pressed against the window. The man's chest bears a tattoo of an Anima Sola. Miranda realizes that Chloe was not making up these stories and, when she sees Chloe the next day, she apologizes and the two embrace. Chloe warns Miranda that her attacker said he was going to target Miranda next.
Miranda begins regaining some of her memories bit by bit and slowly comes to remember killing her husband. She realizes that the girl she encountered on the road was a ghost who had used her body to murder Douglas, thus making Miranda the patsy for his murder, which explains why all of the physical evidence points to her. Miranda, along with Pete, tells the whole story to hospital director Phil Parsons (Bernard Hill), who also doesn't believe her. As she leaves, she sees a photograph of a girl in Phil's office and recognizes her as the ghost that possessed her. Parsons tells her the girl is his daughter Rachel, who had died by suicide four years earlier by jumping off the bridge where Miranda first encountered the ghost.
After being viciously attacked by the ghost of Rachel in her cell, Miranda escapes from the hospital and begins seeking clues to the mystery of why she killed her husband. She goes to her house and sees the vision of Doug's murder, realizing that she had killed her husband while under Rachel's possession. She remembers Doug going to a farmhouse in Willow Creek, Rhode Island earlier that day and believes there might be a connection there.
However, when she arrives at Willow Creek, the house is vacant. In the cellar of a barn, she discovers a room containing a blood-stained bed, what appears to be a box containing drugs, restraints, and video equipment. She watches the tape that is still in the camera and the viewer hears a woman screaming in horror. In the final seconds of the video, Douglas walks into the camera's shot, covers the woman's lifeless body with a sheet, and begins talking to the camera. At this point, the police arrive and an officer draws a gun on Miranda as she is holding a knife. Miranda backs up to a staircase and an injured girl suddenly grabs hold of her from the adjoining crawlspace. The police rescue the girl, but Miranda is taken to jail.
While in jail, Miranda talks to Phil, telling him that Rachel's death was not suicide and that she had been raped and murdered by Doug. Miranda also believes that "Not Alone" means that Rachel was not Doug's only victim. Sheriff Ryan talks to Miranda about how she came to know these things and Miranda discovers that the real meaning of "Not Alone" is that there was a second killer involved in the murders. Using her experience as a psychiatrist Miranda builds a psychological profile and realizes that Sheriff Ryan fits the profile perfectly. He reveals himself to be the other killer and attacks her, revealing his tattoo, an Anima Sola, during the fight.
As Ryan is about to inject a syringe into Miranda, the lights start to flicker and Miranda is able to turn the syringe on Ryan, drugging him. As he goes searching for Miranda, Ryan, under the influence of the drug, begins ranting that he and Doug had killed before. They then started secretly raping and torturing women at Willow Creek, with Rachel being their first victim. After firing his shotgun Ryan causes a gas leak in the police station and, as he sees Rachel's ghost, fires a shot toward her which causes an explosion and sets him ablaze. Miranda then shoots and kills the sheriff. Just a few seconds later, Pete shows up at the station, worried about Miranda's safety after he solved the mystery himself. He looks relieved to see Miranda safe, and through the soundproof window mouths the words "I'm sorry, Miranda."
Approximately a year later, Miranda is seen walking with Chloe on a city sidewalk, discussing how each helped the other come to terms with her experiences. Miranda claims to be free of the ghost's influence and sends Chloe off in a taxi. Miranda then sees a young boy standing in the middle of the road who appears as though he is about to be struck by a fire truck. Miranda yells for the boy to move, but after the fire truck passes through the boy without harming him, she realizes he was only a ghost.
As Miranda walks away, a poster with the words "Have you seen Tim?" and a picture of the same boy is shown taped to a pole next to the street on which Miranda is walking.
Halle Berry as Dr. Miranda Grey
Robert Downey Jr. as Dr. Pete Graham
Charles S. Dutton as Dr. Douglas Grey
John Carroll Lynch as Sheriff Bob Ryan
Penélope Cruz as Chloe Sava
Bernard Hill as Phil Parsons
Dorian Harewood as Teddy Howard
Bronwen Mantel as Irene
Kathleen Mackey as Rachel Parsons
Matthew G. Taylor as Turlington
Michel Perron as Joe
Andrea Sheldon as Tracey Seaver