Is Rocamadour rail station near the city centre? Can I go to visit Rocamadour by train, or do I need a car for it?
Wikitravel points out that there's only one road in and out of the town.
Arguably then, since it's only 3-4km away, you could get off the train, walk 200m north along La Gare road, and look to hitch west along the D673 road into town. Or just walk it - it's only 3-4km, and shouldn't take you more than an hour with bags. There may even be taxis from the station - the trains won't come that often, and the taxi drivers will be aware that people need a ride, and perhaps you could share a cab with someone else getting off the train or even get a ride with them, if they're going into town.
So to answer your question - as long as you're happy 'winging it' once you get there, and are possibly prepared to walk for a little while in the French countryside, then yes, it's totally possible to visit by train.