And do not wish for that by which Allah has made some of you exceed others. For men is a share of what they have earned, and for women is a share of what they have earned. And ask Allah of his bounty. Indeed Allah is ever, of all things, Knowing.
When the following hadith, which are mentioned below, are taken into consideration, it becomes evident that what this Noble Verse is forbidding is wishing which leads to jealousy and enmity. It forbids that one man wishes what another has of worldly and Religious blessings with the hope that they get taken away from the other. This is forbidden.
Based on the above it is also forbidden to wish for something which one cannot achieve except when the one who has it loses it like someone's wife. You cannot have someone's wife unless he loses her. To wish that you get her is forbidden.
Ibn Mas'ud (May Allah be pleased with him) reported:
Messenger of Allah (sallallaahu alayhi wa sallam) said, "Envy is permitted only in two cases: A man whom Allah gives wealth, and he disposes of it rightfully, and a man to whom Allah gives knowledge which he applies and teaches it."
[al-Bukhari and Muslim]
Narrated Abu Huraira:
The Prophet (sallallaahu alayhi wa sallam) said, "By Him in Whose Hands my life is! Were it not for some men amongst the believers who dislike to be left behind me and whom I cannot provide with means of conveyance, I would certainly never remain behind any Sariya' (army-unit) setting out in Allah's Cause. By Him in Whose Hands my life is! I would love to be martyred in Allah's Cause and then get resurrected and then get martyred, and then get resurrected again and then get martyred and then get resurrected again and then get martyred.
[Sahih al-Bukhari Hadith No. 2797]