Try this:
$db = JFactory::getDbo();
$query = "SELECT z.group_id
FROM #__opencart_customer x, #__users y, #__user_usergroup_map z
WHERE x.customer_id = ".
$db->quote($this->session->data['customer_id']).
" AND x.email = y.email AND y.id = z.user_id";
$db->setQuery($query);
$result = $db->loadResult();
For single value results, you don't need to use $db->loadObjectList();
For table names, don't use the actual dbprefix. Use #_
instead. This way you can change table prefix from configuration.php without changing the queries.
Also, no need to set $db = JFactory::getDbo();
everytime. Once is enough!
Hope this helps.. Cheers!