How can I seal a two inch gap in the floor along a wall?
Without seeing it, my first inclination is to get some extruded foam board (not beadboard/Styrofoam--it's too messy) of suitable thickness (3/4" for just the depth of the hardwood, 1" or 1-1/2" for hardwood plus subfloor). Using a utility knife and a straightedge, cut strips that will fit snugly in the gap. Press them in by setting the inner edge against the floor and tilting the wall side down. 

If you fit them well they'll be self-supporting and make a great seal. That said, this probably isn't the only air access to the floor framing. If there's significant air movement between floors you may not solve the problem with this patch.