When you attack a piglin while using an invisibility potion they can see you. This is the case for even when you are not wearing any armor and have no item in your hand.