'Flirting for fun'
At one level, you can flirt with more or less anyone. An exchange of admiring glances or a bit of light-hearted flirtatious banter can brighten the day, raise self-esteem and strengthen social bonds. Flirtation at this level is harmless fun, and only the stuffiest killjoys could possibly have any objections.
Clearly, it makes sense to exercise a degree of caution with people who are married or attached. Most people in long-term relationships can cope with a bit of admiration, and may even benefit from knowing that others find them or their partners attractive, but couples differ in their tolerance of flirtatious behaviour, and it is important to be alert to signs of discomfort or distress.
Research has also shown that men have a tendency to mistake friendly behaviour for sexual flirting. This is not because they are stupid or deluded, but because they tend to see the world in more sexual terms than women. There is also evidence to suggest that women are naturally more socially skilled than men, better at interpreting people's behaviour and responding appropriately. Indeed, scientists have recently claimed that women have a special 'diplomacy gene' which men lack.
This means that women need to be particularly careful to avoid sending ambiguous signals in interactions with married men, and men need to be aware that married/attached males may misinterpret friendly behaviour towards their wives/girlfriends. Otherwise, light-hearted flirtation is both harmless and enjoyable.