Detached DB showing up in back-up history
When you use Delete Database from modern versions of Management Studio, it asks whether you want to delete the backup history for this database in MSDB. The reason that a deleted database is showing in your query is simply because backup history exists for it - in MSDB.

I adjusted your query by joining backupset to sysdatabases, so it excludes databases that do not exist at the moment you run the query. 

SELECT CONVERT(CHAR(100), SERVERPROPERTY('Servername')) AS Server, 
msdb.dbo.backupset.database_name, 
MAX(msdb.dbo.backupset.backup_finish_date) AS last_db_backup_date, 
DATEDIFF(hh, MAX(msdb.dbo.backupset.backup_finish_date), 
GETDATE()) AS  [Backup Age (Hours)] 
FROM    msdb.dbo.backupset 
inner join master.dbo.sysdatabases
on msdb.dbo.backupset.database_name=master.dbo.sysdatabases.name
WHERE     msdb.dbo.backupset.type = 'D'  
GROUP BY msdb.dbo.backupset.database_name 
HAVING      
(MAX(msdb.dbo.backupset.backup_finish_date) &lt; DATEADD(hh, - 24,     GETDATE()))  
 UNION  
 SELECT CONVERT(CHAR(100), SERVERPROPERTY('Servername')) AS Server,  
 master.dbo.sysdatabases.NAME AS database_name,  
 NULL AS [Last Data Backup Date],  
 9999 AS [Backup Age (Hours)]  
 FROM 
 master.dbo.sysdatabases LEFT JOIN msdb.dbo.backupset 
 ON master.dbo.sysdatabases.name  = msdb.dbo.backupset.database_name 
 WHERE msdb.dbo.backupset.database_name IS NULL 
 AND  master.dbo.sysdatabases.name &lt;&gt; 'tempdb' 
 ORDER BY  
 msdb.dbo.backupset.database_name