Probably you are hoping to spray some Miracle Vanishing Formula™, instantly wipe, and be good as new. Maybe it is possible to do that, or use a putty knife carefully.
In the end, you will probably have added scratches, and there are probably defects and worn portions screaming for refinishing. So why not skip to the (seemingly) inevitable conclusion: maybe now is a great time to refinish the whole floor.
Rent a floor sander, either a drum sander, floor stripper, or square buff sander and take off the foam, varnish, and thin layer of the wood.
Usually, it is best to remove floor edge molding to get all the way to the walls, but if the molding is expensive or hard to remove, it is not unreasonable to do a best effort with the edge sander (above right) or an orbital with a shield.
Then add floor finish, sand, buff, and refinish again. It is a lot of work and has to be spread out over at least three days with no use of the room, but it can really revive an iffy room and make it one you can be proud of.