Can mathematics lead to a result which is physically untenable? Consider some known physical fact, e.g.  $\nabla \cdot \mathbf B = 0$ for the magnetic induction $\mathbf B$. Now, is it possible that a mathematical theorem exists, which yields a wrong prediction?
E.g. a hypothetical - correctly proven - theorem that goes: "If $\nabla\cdot\mathbf B=0$ then some new planet should be between Earth and Mars." If this theorem was right, and after deep research we were sure that no such planet exists, one obvious possibility is that the previously known fact was incorrect i.e. perhaps $\nabla \cdot \mathbf B  \neq 0$  under some strange conditions. But is this the only possibility? In other words, is it possible that both the premise and the theorem were right, but the mathematically obtained prediction is not true for physics?
Please note that I picked just a silly example to make myself clear about a question regarding the relationship between mathematics and physics, but of course it is not this particular example that I am interested in. Also, I am not looking to discuss the existence of planets between Earth and Mars and, lastly, I am certainly not questioning the truth of Gauss' law.
 A: There are plenty of examples of this, notably from the beginning of the 20th century, when mathematics applied to classical mechanics & thermodynamics gave wrong answers. Some examples:
1) The precession of the planet Mercury, which is observed to be larger than the value calculated according to Newton's theory of gravity: https://en.wikipedia.org/wiki/Tests_of_general_relativity
2) The structure of atoms.  According to classical electrodynamics, electrons orbiting the nucleus should continually radiate electromagnetic radiation, and collapse into the nucleus, yet they don't: https://en.wikipedia.org/wiki/Bohr_model
3) The observed spectrum of black body radiation didn't match what was predicted by classical theory: https://en.wikipedia.org/wiki/Planck%27s_law
A: Many expressions that can be written mathematically without a second thought don't make sense physically once dimensions are considered.
For example $x+x^2$ doesn't make sense for a lenght $x$. This argument then extends to any transcendental function written as a series.
Dimensional analysis in general puts strong constraints on mathematical expressions, only a tiny subset of them are also valid
when studied in a given dimensional system.
There are many such systems, not only the most known systems such as the SI system or the old CGS, but also very obscure systems, such as Huntley's directed dimensions
or Siano's system. These consider dimensions in different directions to be dimensionally distinct, an interesting side effect of which is that torque and energy don't have the same units anymore.
One application is the Buckingham Pi theorem, which states that any physical law written in the form
$f(q_1,...,q_n)$ can be written as a function of $k$ dimensionless pi-groups $F(\pi_1,...\pi_k)$, 
where $k$ is the dimension of the kernel spanned by the $q_i$ arguments' dimensions.
The Buckingham Pi theorem can be used to derive dimensionless numbers that play a role in fluid mechanics.
All of these arguments also translate to linear algebra, where they put an even stronger constraint on the types of operations that are considered physical.
This is still somewhat of a current if obscure research topic.
A: It is easy to construct mathematics that is self-consistent but does not describe the real world
Mathematics isn't based on observations about the real world: it is based on logical constructions built on various axioms. And those axioms and results may not correspond to anything in the real world of physics. There are far more logically consistent mathematical "worlds" than the real worlds of physics.
Euclidean geometry describes one possible logical world. But it doesn't work, for example, on the surface of a sphere. So the apparent predictions of the mathematical theory don't work empirically if you test them on the surface of the earth. This doesn't mean the mathematics wrong, just that we picked the wrong mathematical model to describe the surface of the earth. Mathematics can construct all sorts of self-consistent geometries but not all of them describe the specific parts of the real universe we actually have.
So, in a very simple sense, it is very easy to construct math that is physically untenable. There are far more logical structures in mathematics than there are in the real world. So many, if not most, mathematics is not physically plausible. The point of physics is to test, by experiment, which mathematical models work in the world we actually inhabit. For example, we once thought Newton's mathematical description of gravity described the real world but careful observations said it was wrong and we adopted a different mathematical description based on General Relativity. And some now pursue even more complex models of the world based on strings or breanes in multiple dimensions (though we don't yet have good experiments to tell us whether those mathematical ideas are better).
A: It is also possible for mathematics to yield solutions that are very likely un-physical while simultaneously having other solutions that are. The Alcubierre drive being one such very likely unphysical solution to the equations of general relativity. But there are plenty of GR solutions that are very real in our universe (Mercury's precession and black holes among others).
A: The Banach-Tarski paradox  seems like an obvious candidate.  It's possible to cut a sphere up into finitely-many pieces, then glue it back together into two spheres each identical to the original

The math is correct, but this is obviously not possible in the real world, so what's going on?
Every mathematical proof is based on some set of "axioms", or assumptions. If the logic of the proof is sound, but we reach some outcome that's impossible in the real world, that must mean that at least one of our axioms does not hold in the real world.  In this case, it's probably the axiom of infinity (or possibly the axiom of choice).

So to answer the question explicitly, if we assume some equation like $\nabla \cdot B = 0$ holds, but that allows us to prove something that doesn't hold in the real world, then that necessarily means one of the assumptions used in the proof does not hold in the real world.
The most likely candidate would be the original equation itself, although it could be something more subtle, like "in step 12 we assume the geometry of space to be Euclidean".  It could even be that the laws of (first-order) logic do not hold in our universe, though if that were the case I think we'd be in trouble!
A: If you have a physical theory, expressed as mathematics, then if, based on the premises of the theory, you prove a theorem which, when translated back into physics, contradicts experiment, then the physical theory is wrong.
So no, it is not possible that both the premise (the physical theory) and the theorem (a thing with a correct proof in other words) derived from that premise are correct, but the conclusion is wrong, and in this case the premise (the physical theory) is wrong.
A: Here is a mathematical theorem: the internal angles of a triangle add up to 180 degrees (i.e. half a complete rotation). To be a little more thorough, let's define a triangle: it is a closed figure consisting of three straight lines, and a straight line is the line of shortest distance between two points. Ok so we have a nice mathematical theorem.
Now we go out into the world and start measuring triangles. They all have internal angles adding up to 180 degrees, to the precision of our instruments, so we are reassured. But then we get more precise instruments and larger triangles, and something happens: the angles are no longer adding up right! Oh no! What has happened? Is it a contradiction? Or perhaps our lines were not straight? We check that the lines were indeed of minimum distance. Eventually we go back to our mathematical theorem and realise that it had a hidden assumption. It was an assumption lying in a subtle way right at the heart of geometry and it turns out that it is an assumption that need not necessarily hold. One to do with parallel lines, called Euclid's fifth postulate. Then we discover a more general way of doing geometry and we can make sense of our measurements again---using the theory of general relativity and the geometry of curved spaces.
So, to answer your question, what happens when physical observations contradict a mathematical statement has, up to now, always turned out to be like the above. What happens is that we find the mathematical statement was true in its own proper context, with the assumptions underling the concepts it was using, but that context is not the one that applies to the physical world. So, up till now at least, physics has never contradicted mathematics, but it has repeatedly shown that certain mathematical ideas which were thought to apply to the physical world in fact do not, or only do in a restricted sense or in some limiting case. 
A: Math is a tool we use to describe the world, if the math doesn't work the math is wrong not the world.  Math is a tool, albeit a very useful one, not a truth.    
A: From our history of science course, there was a sort of opposite example as well: complex numbers. They came about as a mathematically possible but very un-physical solution to equations. Who could make use of a number that does not exist in a physical world?.. in 19th century.
And then aviation came along (proving wind flows around different wing forms), and radio/electronics, and a lot of other applications that you can't calculate without going through numbers that "don't exist".
And suddenly the mathematical curiosity that people at best made fun of, had very serious uses and practical results that we can't imagine the 20th+ century without.
A: What you are asking about is the Scientific Method.
Not only is it possible for mathematical or physical theories to lead to wrong results, but this is expected and wanted when doing science. The key word here is "falsifiability", which means that every theory must include a way to disprove it.
This is a major part of what sets science apart from pseudo-science: pseudo-science usually does not contain a way to disprove its statements. Every scientific theory, theorem, hypothesis, assumption, proposition, statement or however you call them must be falsifiable.
From this, it follows that there is no way to prove something to be eternally correct. Absolute statements of this nature are basically uninteresting; and will, by a good scientist immediately be turned around to find a way to disprove them. If there is no known way to disprove it, it can (and should) be discarded to avoid "white noise".
To your example: "B=0 => a planet exists" can be disproven by showing that "B=0 AND no planet exists". Both sides of this logical statements can and should be looked at separately. To our best knowledge, today, both sides are true, so the whole disproving-statement is true, so your original proposition is false. 
It doesn't stop here, but now the work of the scientist starts. Remember that in your scenario you used maths to derive your statement in the first place. This means that there must be an error somewhere. Either you made an honest calculation error, in which case you bury your paper and forget about it. 
Or - and this is the core of the Scientific Method - you find an error in either your assumptions (i.e., some prior knowledge, for example "B=0"), the mathematical derivation process you used, your interpretation of the process, your measurements (i.e. there actually is a planet which we didn't see before), or whatever else is involved. If you find that, then your ridiculous proposition will lead to a very good result and we gained new knowledge.
A: I asked this related question last year about whether we can use the fact that Quantum Mechanics & General Relativity are inconsistent, together with the principle of explosion, to prove literally any statement e.g. "objects must fall upwards". And indeed, superficially it works. After all if you start with inconsistent statements, everything becomes possible!
Except of course, it's nonsense. As the answers in that question say:

We don't expect physical theories to be true in any absolute sense of formal logic. We expect them to be good approximations under certain conditions.

And

In general, notions from logic and set theory have absolutely no relevance to physics.

