You should be looking at mass loaded vinyl. It's designed for preventing machine noise transmission and is much thinner than those foam sheets so easier to fit into the space.
If you wanted to apply it directly to the walls around the compressor though, you'd be best off using fgoam backed MLV...