If you have a contract with them already, then contact them and see if they will unlock the iPhone for you. As it is a second hand phone they may need the previous owners details before they will unlock, but you might be in luck if you already have a contact with EE yourself.
Contact them and see otherwise, if they refuse to unlock the phone for you, there is absolutely nothing that you can do. You can either sell it again stating that the phone is locked to EE and see if anyone will buy it, or you are stuck with a phone that you can't use unless you take out another EE contract to be able to use it.
I don't quite understand why you bought the phone in the first place if the phone was locked to EE and previous owner did not get it unlocked before selling. Perhaps you should take out a claim with Ebay.