I believe that the most typographically correct method of spelling it out while using numbers would be a 2- to 4-room apartment. (Unfortunately my usual source for such things is silent on this type of matter, but I swear I've seen this in a reasonably authoritative location someplace.)
My logic for this is that 1) using multiple hyphens or dashes in close proximity for different purposes is confusing, so it's better to spell out one of the potential hyphen points; the "to" is the obvious choice since you're going to pronounce it "to" even if it's written as "-", and 2) you would ordinarily write "2-room" and "4-room", so keeping the 2's hyphen with it is the logical way to show that the 2 is still intended as a prefix for "room".