There is no one answer to this question, frankly. There are a lot of variable pieces that are a part of this equation, from the base stats of the Pokemon, to what type it is, leading to what other Pokemon are threatening to it, and so on. It bleeds over into team composition from there, as you begin to look at not just what that individual Pokemon requires, but also at what the team overall needs.
In terms of raw statistics, if you know you're going to be taking a lot of Special Attacks, it's better to put as many points as you can in SpDef and HP. If you are taking Physical Attacks instead, you'd do Def instead of SpDef. If you're expecting to take a lot of each, then you'd want to max HP and equalize Def and SpDef as best you can.
I have, in the past, built a Clefable that does that. Between its Nature and EVs I was able to make it a pretty neutral tank. Teaching it Cosmic Power and Moonlight, and having it hold Leftovers, the only things I really needed to worry about were Steel types. Add to that the ability Magic Guard and it's extremely difficult to bring it down. But sometimes the team doesn't need a general tank. It might, instead, need a Wall.
Walls can be either Physical or Special, utilizing Def or SpDef, respectively. The quintessential Special Wall is Blissey. Absolutely massive HP, and near the top of the scale for SpDef, once you exclude Legends and Mythics. If the opponent is relying on a Special Attacker to get through a Blissey... well, it's just not going to happen. This can, and often does, force a Special Attacker to switch out, to be replaced by a different Pokemon able to better deal with Blissey, like a Physical Attacker. This exploits Blissey's rather low Def, and will probably prompt Blissey to switch out, as well.
It's probably her good friend Rhyperior. About the same Def as Blissey has SpDef, but less HP. Compensated for by quite a nice Atk instead. Rhyperior makes a great roadblock for Physical Attackers, because they are literally beating on a brick while. Except this wall punches back. And since most Sweepers, whether they be Physical or Special, tend to be kinda fragile, they aren't going to want to stick around.