While D&D evolved from a strategy boardgame, it is still a role-playing game. As such, it includes storytelling elements, which, depending on your GM and the players' desires, may weigh far more heavily than monster-slaying.
Some GMs prefer to run their games as a straightforward dungeon crawl: encounter enemies, kill them, repeat. In this case, the optimal character would be the one who is maximally effective at slaying monsters, or supporting fellow party members who do so.
Other GMs introduce logical puzzles into the mix. In this case, while your character may be perfectly balanced for combat, it is still possible to lose due to failing to figure out the puzzle.
Still other GMs prefer to tell a story. In this case, the game is less about killing things, and more about pretending to be a person living in a magical fantasy world... A person who, on occasion, kills things. In this case, the optimal character is the one you enjoy playing. You could make a crossbow-Wizard (perhaps he flunked out of Wizard school, and spends his days fuming at the injustice, shooting other Wizards with crossbows to prove his superiority), a fat lazy Fighter (he used to be a Gladiator, but now he just sits around drinking ale all day, reminiscing about his trophies), an honest Rogue (the prison changed him, for the better), etc. The GM is not, of course, obligated to keep you alive; but at least your game will be interesting.
All of these styles of play are valid. Yes, your crossbow-Wizard won't be effective in combat -- but what if the game is not primarily about combat ?
Jiro has already responded on the central question (with a point that I had already made, but it bears repetition, and apparently keeps being missed when I say it, so my thanks to Jiro). The following is re: other issues mentioned in your comment.
Other GMs introduce logical puzzles into the mix. In this case, while your character may be perfectly balanced for combat, it is still possible to lose due to failing to figure out the puzzle.
Yes, but how does being ineffective in combat help you figure out the logic puzzle? Answer: it does not. Therefore: a c...
There are things that are worthless-- that provide no value. There are also things that are worse than worthless-- things that provide negative value. I have found that people sometimes confuse the latter for the former, which can carry potentially dire consequences.
One simple example of this is in fencing. I once fenced with an opponent who put a bit of an unnecessary twirl on his blade when recovering from each parry. After our bout, one of the spectators pointed out that there wasn't any point to the twirls and that my opponent would improve by simply not doing them anymore. My opponent claimed that, even if the twirls were unnecessary, at worst they were merely an aesthetic preference that was useless but not actually harmful.
However, the observer explained that any unnecessary movement is harmful in fencing, because it spends time and energy that could be put to better use-- even if that use is just recovering a split second faster! [1]
During our bout, I indeed scored at least one touch because my opponent's twirling recovery was slower than a less flashy standard movement. That touch could well be the difference between victory and defeat; in a real sword fight, it could be the difference between life and death.
This isn't, of course, to say that everything unnecessary is damaging. There are many things that we can simply be indifferent towards. If I am about to go and fence a bout, the color of the shirt that I wear under my jacket is of no concern to me-- but if I had spent significant time before the bout debating over what shirt to wear instead of training, it would become a damaging detail rather than a meaningless one.
In other words, the real damage is dealt when something is not only unnecessary, but consumes resources that could instead be used for productive tasks. We see this relatively easily when it comes to matters of money, but when it comes to wastes of time and effort, many fail to make the inductive leap.
[1] Miyamoto Musashi agrees: