do you see how $SESSION['user_id'] doesn't exist when you print_r($SESSION)?
$SESSION is an array holding values. You were trying to select a row from the database where someone's user_id = $SESSION['user_id']. But since $_SESSION['user_id'] doesn't even exist, the database couldn't possibly return anything since you're asking it to give you the user whose user_id is NULL (empty), and there are none.
Now look at your print_r. The key in that array that we were looking for is xoopsUserId, not user_id.
Now I don't know what you have your user id column named in the database. You are going to need to figure that out or this will never work. I'm going to assume it's called user_id for the sake of simplicity. Once you figure out what it is, you'll need to replace it in your SELECT statement and when you call $row['user_id'] (replace user_id with your column). Then use this code:
$query = mysql_query("SELECT user_id FROM yourTable WHERE username='".$_SESSION['xoopsUserId']."'") or die(mysql_error());
$row = mysql_fetch_assoc($query) or die(mysql_error());
// the name of the xml file
$file = $row['user_id'] . '.xml';