Hmm. I wouldn't use it personally, just because I'm paranoid and have awful visions of itty bitty pieces of polystyrene eventually being nibbled on/breaking off to be swallowed by greedy bettas.
That said, half a polystyrene cup is what a lot of people use to encourage their males to bubblenest; it's just not going to be left in the water for an extended length of time. Hmm. Maybe if you coated it with something nontoxic it might be safe? SRC built some beautiful foam caves, but she did mention they were quite light, so you might have a hard time anchoring a foam divider. Also, it wouldn't permit water to flow through, which is important if your tank is big enough to require a filtration system. It certaibnly would bear looking in to, though, if you have the equipment on hand.