You have a few not very good options for overcoming resistance, and only one option for overcoming immunity, albeit drawn from "unofficial" content.
Your best option is probably the Elemental Adept feat, as it is "permanent".
But it only overcomes resistance, not immunity. This is probably the only really viable option in the rules as written, and it's not great, but it does best fit your character's needs.
So far, the only way to overcome immunity is the Pyromancer.
Note: Even though this is published by Wizards, it is unofficial content, meaning it is not vetted at the same level as official content.
The Pyromancer is a sorcerer from a Planeshift Pdf detailing the Magic:The Gathering setting of Kaladesh for use in 5e. At 18th level, they gain the following:
Fiery Soul
At 18th level, you gain immunity to fire damage. In addition, any
spell or effect you create ignores resistance to fire damage and
treats immunity to fire damage as resistance to fire damage.
Other options
There is the Elemental Bane spell. But that only covers resistance, requires a save and is concentration. Not a good option.
You can also look to spells abilities and items that grant vulnerability, as this is pretty close to the same as eliminating resistance (but again, it does nothing to immunity). Spells like Hallow and Contagion (flesh rot option) do this. Or Channel Divinity: Path to the Grave from a Grave Domain Cleric.
Any other ability I found is related to switching out the damage type, ala the Order of Scribes Wizard Subclass, which is not exactly what you want. Although, technically it does effectively bypass immunity to a given damage type. Check under the Awakened Spellbook feature.
Along those lines, in Tasha's Cauldron Of Everything
there is a sorcerer metamagic option called Transmute Spell (remember any spellcaster can now get metamagic using feats) which reads
When you cast a spell that deals a type of damage from the following list, you can spend 1 sorcery point to change that damage type to one of the other listed types: acid, cold, fire, lightning, poison, thunder.
Immunity/resistance would be applied before the damage transfer
Note the timing of the damage mentioned in the Shield Guardian's text (MM, p. 271, bold added)
If the guardian is within 60 feet of the amulet's wearer, half of any damage the wearer takes (rounded up) is transferred to the guardian.
A character hasn't "taken" damage until all the modifiers to damage have been factored in. For evidence of this, note the text on resistance and immunity in the PHB (p. 197, bold added).
Resistance and then vulnerability are applied after all other modifiers to damage. For example, a creature has resistance to bludgeoning damage and is hit by an attack that deals 25 bludgeoning damage. The creature is also within a magical aura that reduces all damage by 5. The 25 damage is first reduced by 5 and then halved, so the creature takes 10 damage.
This description implies that the following three things happen in this order:
- an attack or effect "deals" damage
- Immunity or resistance reduces the damage
- target "takes" damage.
Since the shield guardian transfers damage that its amulet's wearer "takes," it will transfer damage after the resistance/immunity had been applied.
As an example, in the case where the target (wearer of the amulet) has immunity to fire damage, an effect would deal fire damage, and then immunity would reduce that damage to 0. At that point, either your DM would say "your character doesn't take damage, so the Shield Guardian's effect doesn't activate" or would say "your character takes 0 damage, and half of 0 (rounded up) is 0." Either way, the Shield Guardian would take no damage if the wearer of the amulet was immune to that damage type.
Resistance would work similarly. If you are resistant to a damage type and are dealt damage of that type, your resistance would reduce the damage, then you would "take" the damage, but half of the damage "taken" would transfer to the Shield Guardian.
As a final corroboration, Jeremy Crawford has confirmed this reading.
If you have a shield guardian, half of any damage you take is transferred to the guardian—that's half of the damage you actually take, after resistances and the like.
Best Answer
They Both Apply (ALMOST 1x damage)
On page 197 of the Player's Handbook, it states (bolds added):
This means that you would apply resistance, and then vulnerability to damage, in that order. This often would mean that you would only take the normal (x1) amount of damage: but not always. Note that on page 7 of the PHB, it states:
As such if the damage dealt was odd (eg, 15) first it would be halved, by resistance, rounding down (eg, to 7 from 7.5). This halved damage would then be doubled by vulnerability (eg, increasing it to 14).
DMs might ignore this fringe case, as it can only result in a 1 point damage difference. But it is an accurate feature of the rules as written.
As far as Immunity goes, Vulnerability/Resistance both apply to enemies who also have Immunity, but to no particular effect. After all, halving or doubling 0 will still result in 0.