Yes, you can defrost a freezer while it’s turned on. If it’s a fridge freezer, you can stop cooling the freezer section and open that door, while still keeping the fridge cool. For a freezer only, you might have to keep it switched on if you can’t reach the plug, for example. In that case you should turn the freezer’s thermostat up to its least cold setting, open the freezer door and wait.