People who say that you shouldn't name a number first are presumably thinking of a scenario where the employer is prepared to pay, say, $100,000, and then you ask for $50,000 and they immediately agree and you've lost the potential higher pay.
But there are other possible scenarios that work against you. You refuse to give a number. They look at your resume and say to themselves, "Someone with these qualifications will probably demand $100,000, and we just can't afford that. No point wasting our time interviewing him." If you in fact were prepared to accept $50,000, you might have just finessed yourself out of a job.
Realistically, if you aren't going to take a job for less than $100,000 and the most the company is prepared to offer is $50,000, there's no point even scheduling an interview. You're just wasting both of your time.
If the company has no idea what the current market rate for this job is, by naming a number first you may establish an expectation. If when you walk in they're saying to themselves, "I wonder what people like this get paid these days. $50,000? $100,000?" If you say you expect $100,000, they might sigh and say oh well, I guess it's the upper end of what we were expecting. If they name a number first, they might well offer the low end. There's some psychology here: someone can get a "reasonable number" in their heads and be unwilling to move far from that, even if there was no reasonable basis for the "reasonable number".
And while it's no doubt fun to think that I might walk into a job interview and the company offers me ten times what I was expecting, realistically, that's not likely to happen.
I think in real life, when someone applies for a professional job, he probably has more control over the final salary negotiated than the employer does. If the applicant is presently employed, he's rarely going to accept a pay cut to take a new job. He's likely to be happy with a modest increase. So if he's presently making, say, $50k, he'll probably ask for $55k or so and be happy to accept $52k. The range between his asking price and his minimum is pretty small. From the employer's point of view, unless they're a very small company or this is a very high-paying job, what they pay this person is a small percentage of their total budget. If they were expecting to pay $50k and a candidate comes along who seems highly qualified but he demands $55k, they might well decide to just stretch a little and do it.
When I'm buying a product, I get very suspicious of a company that refuses to tell me their price. When I see an ad that says "call for pricing", I never call, because I take it for granted that if they had a good price, they would list it in the ad. If they want me to call, that must mean that their price is high, and they're hoping that if I call they can talk me into it with a slick sales pitch.
So my conclusion: I don't volunteer a salary number. But if someone asks, I give them a number.