Can you confirm that this is the computer you are talking about?
http://h20564.www2.hp.com/hpsc/doc/public/display?docId=emr_na-c04543968
Does your computer have the R7 240 installed?
If that is your computer, the answer is NO.
The GPU will fit in your motherboard, but the system has only a 180W PSU, and the GTX 750ti, while very low power, draws up to 65W through the PCI-e slot of the motherboard. Combined with the rest of the system, that's more power, as a percentage of total, than I would want to draw from any PSU.
Upgrading the PSU will be a challenge because it is external and I'm not sure the internal wiring will handle 300W.