Mixed gyms are Haraam. Add music into the mix and the Hurmat (prohibition) is compounded.
The Sharee`ah of Islaam teaches us to avoid all places of Fitnah. Avoid places that will cause you to fall into sin. The women who attend these mixed gyms, in most cases, they're "almost" wearing clothes. They're "almost" dressed. They are wearing so little that, in terms of Sharee`ah, they are naked, and thus they can't be said to be "dressed". Obviously, it is necessary for a Muslim man to stay very far away from such a place. You mentioned in your question something about wearing headphones and not looking at them. Do you really believe that you will not look at any of them? Shaytaan tells the person that he won't, but when he gets there, his eyes are darting all over the place and he forgets all about some headphones and not looking at the "almost" dressed women working out there.
In summary, it is not permissible for you to go to a mixed gym. If there is a gym which is reserved for men only, go there, otherwise train at home or train outdoors somewhere free of women.
والله تعالى أعلم