Hayes, Nick's former partner, is a deado, and he is collecting the gold pieces to assemble a staff that will allow the dead to return to Earth. Roy destroys the staff by dropping a street sweeper on it, then Nick erases Hayes. Julia dies, but she is able to see Nick and he gets a chance to say goodbye to her. Mildred pulls some strings so Julia can live, and Roy and Nick are reinstated to the R.I.P.D.
Nick Walker (Ryan Reynolds) is a Boston police detective who, along with his partner Bobby Hayes (Kevin Bacon), recovered and shared several gold pieces during a drug raid. Hayes kept his pieces, but Nick wants to turn his pieces in to evidence. The next day, while attempting to apprehend another drug lord, Nick is killed by Hayes because he didn't want Nick's gold pieces turned in. Nick wakes up, sees the world frozen in place, and is pulled up through a tunnel in the sky. Just as he is about to face his eternal judgment, Nick is yanked into an office and is interviewed by Officer Mildred Proctor (Mary-Louise Parker) of the Rest In Peace Department, or R.I.P.D. The R.I.P.D., staffed by good cops who were killed in the line of duty, are responsible for the apprehension of dead people who remain on Earth and have yet to face judgment, which they refer to as a "deado". The longer a deado stays on Earth, the more their soul rots and they will turn into monsters. She offers Nick a job and he accepts the offer, and is assigned to be the partner of former Old West lawman Roy Pulsipher (Jeff Bridges).
Roy and Nick return to Boston and go to Nick's funeral, where they see his widow Julia (Stephanie Szostak). Nick goes to her, but she doesn't recognize him. Roy then tells Nick that since the universe won't allow the R.I.P.D. to be seen as their actual selves, they appear to the living as other people (a.k.a. an avatar). In their case, Nick's avatar is that of an old Chinese man and Roy is a stunning blonde woman. Roy then tells Nick what to expect on the job. A deado looks like a living person until they are exposed to cumin, at which time the monster inside them is irreversibly revealed. On their first assignment, Roy and Nick attempt to apprehend a deado, who tries to escape after grabbing some gold pieces. Roy shoots the deado, which causes it to be erased from existence. Nick sees the gold pieces, and notices it's similar to the ones he and Hayes found. Nick wants to know why these gold pieces are suddenly showing up and begins an investigation, which is something the R.I.P.D normally doesn't do. Roy and Nick go to one of Roy's informants (a deado who is allowed to stay on Earth on the condition he helps the R.I.P.D.), and gives him one of the gold pieces. The informant then calls someone and later gives him the gold piece. That person is Hayes, Nick's former partner, who in turn gives it to another deado named Pulaski, who looks like Elvis. Hayes then goes to Nick's old house and finds his share of the gold pieces.
While Roy and Nick attempt to capture Pulaski, the monster inside him is revealed to the living, which is the one thing a R.I.P.D. officer is never supposed to allow. As a result, the duo are suspended from the force and will face eternal judgment. Despite their suspension, Roy and Nick return to Boston and arrest Hayes, who is revealed to be a deado. He wants the gold pieces to assemble The Staff of Jericho, which would allow the dead to go through the sky tunnel the other way and return to Earth, which would mean the immediate death of the living. They bring Hayes and the gold pieces he currently has to the R.I.P.D. station, but while the gold is being placed in evidence with the gold pieces that were found earlier, Hayes activates a device that slows down time. The officers are moving in slow motion, but the deadoes are not affected and take all of the gold pieces and police weapons and return to Boston. While this is going on, two of Hayes' deado associates have gone to Nick's old house and taken Julia.
Once the slow motion device is destroyed, the entire R.I.P.D. goes to Boston, including Roy and Nick. Once they arrive, they discover the staff is being assembled on the roof of the Commonwealth Building. They are also caught in a series of whirlwinds that the nearly completed staff is causing, which is making cars and other vehicles fly throughout the city. One of the vehicles, a street sweeper, lands on top of the Commonwealth Building. Roy and Nick shoot their way to the top of the building, where they see several deadoes, Hayes (now as a monster), and Julia. The staff is now fully assembled, and Hayes reveals that the last piece needed is the blood of a human sacrifice - Julia. He then stabs her, and her blood activates the staff. As the sky tunnel is opened and the dead begin to fall to Earth, Nick shoots the deadoes and goes after Hayes, while Roy attempts to take apart the staff, but with no success. He then uses cables on the roof to form a lasso and ropes the street sweeper, then pulls it down onto the staff, destroying it. This makes the falling dead go back up into the tunnel. Nick then shoots Hayes, erasing him.
Nick goes to Julia, but she is dead. With the world frozen, she sees Nick and he tells her goodbye before she faces her judgment. As she is pulled up through the tunnel, she wakes up in a hospital bed. A doctor tells her that she lost a lot of blood, but will live. He leaves the room, and it's revealed to be Mildred (the doctor was her Earthly avatar). She tells Nick that she pulled some strings and Julia will be allowed to live. Back at the station, she tells Roy and Nick that their suspensions have been lifted and are reinstated to the R.I.P.D. The movie ends with Roy telling Nick that he was able to get his avatar changed, since he didn't like being an old Chinese man. Nick's new avatar is that of a Girl Scout.