It's attached to the fuel pump and is fiddly to remove, I did it recently when I changed tanks from red to grey. Here's what I did.
Firstly put the wires and sensor back into the tank, the whole lot comes undone from inside the tank. To get at the pump you have to remove all the filler cap assembly, once you get the cap off the base is held by a number of grub screws on the inside edge. When those screws have been removed you can pull the thing out, carefully, because it's held in place with a big 'o' ring which comes away with a pop once you eventually get it to move. If you got this far without tears you should be able to get your hand inside the tank to the rear and remove the fuel pump from it's spring clip retainer. Ease it forward till you can see the wires' connector, which will then pull off the pump and allow you to pull the sensor and wires from the tank. When you put it all back together don't forget the gasket between the sensor and tank, it'll leak without it. Re-assembly is more tricky than diss-assembly, take care and be patient especially with the black rubber seal that goes between the filler assembly and the tank.