I'll post a dissenting view.
Other answerers are correct in that "the" typically refers to a specific beach whereas "a" typically refers to just some beach somewhere. That's why they're called definite and indefinite articles :)
However, in practice I think it's entirely plausible that one could say "I want to go to the beach" and not be referring to any particular beach.
Take me. I live in Kansas (in the United States) where there's no ocean for 1000+ miles in any direction. Here in the land of grass and wheat, every day somebody says "I want to go to the beach." Translation: I want to go on vacation to somewhere by the ocean.
Which ocean exactly they're talking about, though, nobody knows (at least not from that one sentence). Heck, most of us would be satisfied with seeing any ocean.
There's also a beach on a small portion of a lake near my town, though, and so in the right context "I want to go to the beach" could be referring to that particular beach as well. But in my (geographical) situation, it would be the context that would determine if we are in fact talking about the beach at the lake nearby or just some beach for some ocean out there somewhere in the world.
Contrastingly, I imagine that people who live close to an ocean don't have this problem of wanting to look at something besides grass all day, so if you heard one of those people say "I want to go to the beach" you could make a safer assumption that they are talking about the beach for the ocean that is closest to them. Because there is a beach close to them, someone living close to an ocean would be more likely to need to say "I want to go to a beach" in order to convey the idea that they want to take a vacation somewhere.