I was trying to trade a Pokemon from Colosseum to Emerald, however, I found that for some reason, my legal Deoxys is flagged as illegal by the game and cannot be traded. See in the image that even though it is in the top right of my party, there is no picture there. However, I have another Deoxys which is actually the exact same Deoxys, just not leveled up in my Emerald game. However, even though PKHex labels it as legal, it still cannot be traded. I tried trading in the same Deoxys from Emerald, and it appears and can be traded just fine. But what is wrong with my Deoxys that the game flags it as illegal and cannot be traded All I did was take that same Emerald Deoxys file as a pk3 file and moved it into the game with PKHex so I could use it in a playthrough.
Also note that for some reason, Deoxys has the Fateful Encounter Flag in Emerald before being trading but had it removed after being traded.

I do not know what is going on, however, the Deoxys that I traded in can be traded back just fine, but the other one isn't even showing up on the trade screen.
I will attach the save file both before the trade and after the trade, as well as the copy of Pokemon Emerald from which it comes (It is located in Box 11, Slot 11). Also, the only legal issue with the Emerald Deoxys is that it is EV trained without receiving experience, yet it can still be traded
PS the same problem is happening in XD with a legal Smeargle that I injected. Although I don't have a picture of it, when I try to trade it to Pokemon Emerald as well, it states "An Illegal Pokemon may not be traded". I will attach its save file as well.
Colo was probably checking the fateful encounter flag, and since it wasn't there, it was invalid.
But it seems to be backward. The Deoxys the game is flagging as Illegal is the Deoxys that has the fateful encounter flag checked. However, the Deoxys that can be traded in and out just fine is the Deoxys that lost its flag upon being traded.

Why does it even lose the flag upon being traded?
Does it receive the Fateful encounter flag when transferred back to gen3 (legit transfer, not pkhex)
Could be the fateful flag is stored at another offset and PKHeX is read/writing it incorrectly.
Maybe a dump of the two deoxys (legit vs pkhex-transfer) so the data can be compared?
I traded the Deoxys back
and then Extracted the Emerald Save into PKHeX

sure enough, the Fateful Encounter flag has been "restored" upon returning to Emerald. I also tried removing the fateful encounter flag of the illegal Deoxys to match the legal one, yet it still couldn't be traded. I would hypothesize that the fateful encounter flag is stored somewhere other than where PKHeX thinks it is for Colosseum and XD Pokemon. So when I drag and drop a Pokemon file into a colosseum save, it doesn't actually check the right flag. I would hypothesize that if I could force the game to trade it, it wouldn't have the fateful encounter flag in the GBA game. Although the Smeargle still cannot be traded from XD.
386 - Pokemon Files.zip
Looks like they're really the same thing, and that the fateful encounter flag is misplaced.
EncounterType should be deleted and Fateful should read from that offset.
Also looks like -100 is set for the shadow gauge. Maybe this is a requirement too (shadow gauge must be less than 0 to be deemed 'pure').
I'm not sure about the XK3, since there's no 'legal' variant to compare against.
Okay, so doing the same thing again with Smeargle. Like before, the Smeargle was dropped into XD with PKHeX, yet it cannot be traded. So I copied that exact same Smeargle to Emerald with PKHeX, and linked Emerald with XD for a trade. Notice an identical Smeragle in Emerald
Trading the legal one from Emerald into XD
And notice that the one traded in from Emerald is legal and can be traded like normal
Looking at the extraced XD save file, they look completely legal and identical

I will attach the two smeargle files and the save file.
XD Pokemon Files.zip
I'm not able to figure out what's blocking the xk3 from trading