The invisibility potion doesn't affect the Wither. It can still easily detect you. However, the Ender dragon won't be able to detect you if you are invisible until you take any aggressive steps.