>>4765054285% of the time the answer is ALWAYS to just invest in it's better stat and pair it with something else that covers the one it lacks. Defensive Cores exist for a reason.
Very rarely, however, a Pokemon with a high defensive stat and a slightly lower other defensive stat can invest in the lesser of the two and make it work. It's rare, but it's been done before. And some Pokemon have close enough defenses that they can viably invest in either one. But if we're talking strictly "Dude has 150 def and 85 sp.def" you're going to invest all in on the defense because doing otherwise is a waste.