Edited by Nighteyes: this theory is incomplete - the open Slot is not sufficient when attacking a den, therefore it could be in a den or without sufficient space????
For me it happend regardless of in den or not, but it seems to be connected to the size of the attacking army.
Everytime I do not have an open slot in my (attacking) army to join the tamed beast immediately with the Tamer in one army, the beast gets in the "greyed" mode and is lost as soon as it enters a City, but can be used freely outside of the cities as far as I have observed.
Unfortunately looking at a single beast army you can not even see, if the beast is "greyed". 
The general concept of requiring an open Slot could be intentional ??????? It forces you to attack with a smaller army when trying to tame a good unit for an all purpose use, and therefore adds some difficulty to the beastmaster mode.
Note 1: If the greyed out beast is in a separate army or is leading an army, that army does not appear in the troop list on the left.
Note 2: When taming a beast during a city-attack the tamed beast is not lost, but waits outside and can be joined into the City afterwards.
(My Scenario:
Army size Limit 6,
Attacking Army is size 6,
City has a Spider as one of the defenders,
I tamed it in the battle and won without losing troops.
My 6 troops moved into the City and the tamed beast stayed outside, but was not "greyed". (I assume during the decision for "Greyed" or not the City-Army Limit of 9 was applied instead of my open field army Limit of 6?????
(I have not run double-check tests to prove the behaviour, but so far it happens that way consistently for me.)
(I have no experience regarding taming Events during defense!!!!)