Android L Preview upgrade I was about to flash the phome with the command prompt, but an error came up saying that the device was locked. Does this mean is has to be rooted? If I root it and upgrade it will it be unrooted again because I don't want to loose my warranty.
It sounds like your bootloader is locked, which is different from rooting.  With a locked bootloader, you can only flash official signed factory images; with it unlocked, you can flash anything to any partition.

If you're following Google's directions for installing factory images, you'll see that one of the steps is to run a fastboot oem unlock command.  This unlocks the phone's bootloader.  It also erases all your data.  (But installing the L Preview system image will do that anyway.)