In D&D, invisibility is dispelled as soon as you attack someone. This is a game balance mechanic, as it makes it fair for the enemy. If you kept your invisibility, you cause your opponent to take a -4 to hit penalty. So it does make sense, in a "fairness" kind of way.
I was thinking that maybe you should keep your invisibility until you are hit. It makes it tougher on your opponent, but I think you being wounded would make you much easier to find, especially if you were cut by a blade. Not sure if this would make invisibility too powerful. Maybe increase its spell level to 3. Just an idea.