Inspect the shank of the doorknob for a small hole or indentation.
Slide the end of a small screwdriver into the hole in the shank.
Tug on the knob with the screwdriver still inserted in the hole. The knob should come right off.
Inspect the inside for signs of rust. Spray the locking mechanism with liquid graphite to lubricate. Reinstall the door knob and test. If this doesn't work, you need to remove the knob again.
Pull off the knob and remove the rest of the hardware from the door. Insert new hardware from a door knob kit and reassemble.