It can be a grey area, but apart from the excellent advice to read submission guidelines carefully I feel the need to add the obvious: 'published' means published, whether somebody else publishes your work (eg journals, print or online) or you publish it yourself (in print or online). 'Published' means being made available to the public, it's as simple as that.
If you share your work with half a dozen friends in a coffee shop or 30 peers in a college classroom or post it for c & c on a private (membership only) website, such as THF forums which require you to be a member, Yahoo groups etc, that's not publishing it. If you share your work with all your facebook friends or post it on your blog which can be accessed by the public via an internet search engine, then you have published it.
Various journals have different requirements. If , after reading the submission guidelines thoroughly, you are still unsure in relation to any particular journal, include details of where you have first published your work or had it published and leave it up to that particular editor's discretion.
The same applies to competitions.