The only thing that supports your sub floor is the metal framing. The foam is in between the frame sections. It is difficult to remove the damaged floor and put new flooring in unless you are very lucky and the damaged area is between frame sections that can be accessed. The framing is not very wide and putting a new section on half the width may not product the desired results.
Before you remove the damaged area, go here and do some reading:
Wood preservation, rot repair, and restoration using epoxy resin on boats and homes.
You may find a product that you can use to make the floor solid again without removing it.