Some have suggested that railroading is what happens when the DM robs the player of a choice. I don't think this isn't necessarily true. When I remove certain feats and spells from the game, I'm not doing it because I have a specific story arc in mind. It restricts player choice, but since the story doesn't exist yet, there is nothing to railroad.
So to me, railroading is something that you do to the story, not the players. It doesn't have to have anything to do with telling a player "no, you can't do that." In fact, it can be completely invisible to even the keenest player. For example, imagine the following encounter key.
1. Main Chamber: this 20' x 20' room has heavy oak doors in the middle of the north, south, east, and west walls. Each doorway opens into a 70' long corridor that extends outward into darkness. Regardless of which corridor the party chooses to take, it will lead to Area 2, described below. If the party splits up, one of the groups (chosen randomly) arrives at Area 2 and all others arrive at a dead end.
In this example, I have given the players the illusion of a choice, when they don't necessarily have one. And they will never know unless they read my encounter key.
Another way it can be done:
Chests: In this crypt, there are twelve treasure chests, shown by the symbol ($) on the map. The location of the chests or the order in which they are opened is not important.
The first chest the party opens, regardless of its location, contains one ruby (50 gp value) and the key to Room #3.
The second chest opened will be boobytrapped with a poison dart, and contains a bag of sand.
The third chest the party opens contains...etc, etc.
Again, the players think they have a choice, but they really don't. I have already decided the results of their exploration to fit my story. And like any good railroad engineer, I've written it so that the players will never know. Choice is unaffected, at least from the perspective of the player.
Not that I would ever do this to my players.

I'm just saying, it can be done. And it can be done in such a way that nobody would ever know. But anyway, if a tree falls in the woods and nobody is there to see it, was it scripted?
The example I gave about the thief wanting to pick the pocket of the king (and me putting the kabosh on it) made the player angry, and that's not cool. I
was trying to keep the game on track...but I don't think that is a bad thing. I think it's part of the DM's job, actually.
I guess I could have allowed it but make it unimportant, as some have suggested. For example, I could have just rolled a die flippiantly behind the screen, ignored the result, announced that his attempt was successful, and give him the king's grocery list or something equally worthless. He would have gotten 20 seconds of everyone's attention, everyone else would have rolled their eyes, and we would have continued on with the story at hand.
But if I were the player, I think that would have made me
even more angry. I'd rather be told "no" than be placated.