Question:
Is this blessing recited upon hearing bad news in general? Death of innocent gentiles? Righteous gentiles?
Answer:
This bracha is only meant to be said when the person had something and that was taken away from him, such as a relative or his business got ruined. Regarding saying it when someone died, it is usually only said when someone died that the person is personally very upset about, and even then it isn't with shem umalchus. This would not apply to a gentile.
Best wishes
Sources:
Biur Halacha 232 D:H Dayan, O:CH 225-9, Shaar Hatzion 218-22.