Thank you BlackBox for the response. The link to the code that you provided works nice only if one is in the Model Tab or in the Layout Tab.
However if you are in the Layout Tab (Paper Space) and you are looking via the viewport at the Model Space then the code will return the Model Space ID.
I overlooked your earlier statement that you're attempting to identify the active space from a side Database... The only other thing I can think to suggest without Googling, is for you to consider Database.CurrentSpaceId as Kean suggests here:
... Perhaps someone much smarter than I will be along shortly, to better suggest a solution. Sorry I could not be of more help.
Access a broad range of knowledge to help get the most out of your products and services.
Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.
Upgrading to a 2015 product? Make sure to check these out 1st!