Your code looks wrong. Try this. You should be operating on the thing you spawned, not the game object running the script, unless I'm mistaken what you're trying to do. You're trying to set the parent of what you spawn, right?
var spawned = PoolBoss.SpawnInPool(obj.transform, Vector3.zero, Quaternion.identity); spawned.GetComponent<SpriteRenderer>().color=Color.red; spawned.SetParent(Camera.main.gameObject.transform);
If that still doesn't work, Unity disabled this functionality when they did the nested prefabs stuff in 2018.3, nothing I can do to fix it. You may want to ask on the Unity forums. If you do, please send me a link so I can subscribe because I'm interested too.