A MIDI cable should have pin 2 (Shield) connected on both ends. (to be symmetrical)
A MIDI OUT port should have Pin2 grounded, a MIDI IN port should have pin 2 left NC.
egarding disconnecting the earth at one end, this is a common bad practice. Also an earth loop is not formed by connecting 2 devices at multiple points, that is a total misunderstanding of the concept of earth loops. In fact the best practice is to create a combination mesh and star earth using an earth bus and as many earth connections in between interconnected devices as possible.
Disconnecting the earth where you have bad earthing will help to avoid coupling (capacitively within the cable) the earth circuit related noise (hum and buzz) with the midi signal, but this is a bandaid solution. at the same time keep in mind you will increase the amount of rfi coupled to the midi signal. but yes due to the optoiscolators, this should not be a problem. but it should be correctly understood.