Yeah, I'll be glad to explain how I did it. I should point out that I made it work for G&K. CivilopediaScreen.lua is slightly different for vanilla, so you'll have to do it slightly differently, even though the basic idea is the same.
First, you have to add a column to the buildings. I added the column "PediaVisible" through SQL.
Default is 1 because PediaVisible will be "true" for pretty much every building.
Then you make some minor adjustments to the CivilopediaScreen.lua. There are two small changes you have to make. I've included my .lua file. If you want to find the changes I made, just Ctrl-F "trystero" or "PediaVisible" and you should find them.
If you are wondering what the logic behind the changes are: basically, the lua code makes a local database from the Buildings database by looking for certain parameters. These parameters are there to ensure that Wonders and projects are excluded from the Buildings section (because those are listed in the Buildings database). I added a bit of code so that the local database the lua code creates only takes buildings that are labelled as PediaVisible. So if I want to make a building that doesn't show up in the civilopedia, I simply add "<PediaVisible>false</PediaVisible>" in its XML code. (You can do it with SQL too.
Note that I had to add that code in two different places. This is because one snippet of code deals with buildings that have tech requirements (and are put in a certain era), and the other snippet of code deals with buildings that have no tech requirements (and are put in the ancient era).
You could use this with Thal's code to make buildings that don't show up in the cityview so you have a totally invisible building that you can use to implement certain traits.