There is a view that you can query
select * from sys.database_mirroring
you can read more about the mirroring catalog views on
http://msdn.microsoft.com/en-us/library/ms178655(SQL.90).aspx"> http://msdn.microsoft.com/en-us/library/ms178655(SQL.90).aspx