I set my domain in the WordPress without www i.e xyz.com but realised after setting that xyz.com wasn't redirecting to www.xyz.com. Now I am unable to login into the admin panel. I grepped through the code but saw that the domain is not set as a value to any variable. Is it saved in the DB? How can I change it?
You need to change your url for two places one is for "WordPress address (URL)" and for "Site address (URL)"
As you are unable to login to admin panel there is one option you can change it by modifying your database table in phpmyadmin. You might also need to udate Upload URL as well.
Easiest way to search tables is search your defined URL (e.g xyz.com) than you will find all tables using that URL than change all those to your full URL I would prefer with http (e.g. http://www.xyz.com)
Also check your config.php at root and if url is there and not correct than change it too.
If you are not using such plugin than it should not more than 2-3 places.