This is an insane problem that I have had for 10+ years and never solved it: When trying to get solder to stick to metal, it won't. Not hot enough? I scorch the piece in lava heat for what seems hours, no dice. The tip of the soldering iron is so hot that solder liquifies immediately when touching it. On the metal tab? Nope, it stays solid when I heat up the tab by putting the soldering iron on it for 5 mins. The solder DOESN'T WANT TO GO ON THE TAB, no matter what I do, push it, kick it, force it, nope... I can even encase the tab when I dump a ton of solder on the tip of the solder iron, it stays away from it like oil and water. All solder beads off like water off a layer of oil. I cleaned the tab, roughed it up, no dice, nothing. It is like the damn thing is bewitched. I don't have this everywhere, but some surfaces that are clearly metal and clearly electronic conductors meant to be soldered just don't want to have any. What is going on here? And how can it ever be that I heat up the metal tab to the same burning heat than the tip of the soldering iron, giving it tons of time to heat up, the solder won't liquefy ever on it when touching the tab with the solder?
If solder doesn't stick to a metal surface, I see three possible reasons for this:
The part you want to solder is not hot enough - the metal surface has to be brought to the melting point of the solder, otherwise it will not make sufficient contact and the solder joint will eventually fail. If that is the case: get more heat.
An oxide layer keeps the solder from making contact - in this case you need to remove the oxide layer by either scratching it off or using flux to break up the oxide layer. Depending on the type of metal you might need a special flux. E.g. if you want to solder to aluminum, flux intended for use with copper doesn't work.
The solder is not soluble in the metal you try to solder to - solder and metal will form a quasi-alloy at the junction, but this requires solubility. There's nothing you can do if solubility is not given, just like you can't dissolve sugar in oil.
So, not all metals can be soldered together. For example you won't find any solder that has sufficient solubility in both stainless steel and copper. Some metals - like aluminum - can be soldered to copper in general. But doing so is tricky: aluminum forms a strong oxide layer very fast. So after scratching it away you have to protect the solder point from oxygen (e.g. coat with oil) until and especially while soldering (oxide formation is much accelerated at high temperatures). This is all a big pain in my experience.
Another important point is the galvanic series: if two metals have different nobility, the less noble metal will be corroded away in the long term. That's the reason why aluminum and copper should not be soldered together, though it is possible. Take a look at this effect for aluminum and mercury.
In addition to the answer by @Sim Son:
The PCB layout could be bad. This is a more common problem than it ought to be. If you attempt to solder for example a connector to the board, and all pins but one can be soldered just fine, then the problem is most likely that the ground signal pin is routed straight into a ground plane. Which in turn is a large copper area acting as a perfect heat sink - one which the solder iron will never keep up with. This is a particularly common problem with antenna connectors.
It's important that all pins connected to large copper areas of the PCB are connected with thermal relief, so that the solder iron can warm up at least the closest part enough for the solder to properly wet.