I would be unlikely to use it in prose because there is enough context to show that someone (or something) is being addressed, but in poems I often find it’s needed for clarity.

And you give a good example – there’s a world of difference between “Oh lord!” and “O Lord”.