Depends on the system type to determine how independent it is. Some have their own magnetometers (also powered from the emergency battery), some use AHRS/IRS for their heading input only.
In the end it is down to 2nd and 3rd order failures to have a total loss of attitidue and/or heading........now that has never happened before