I think something inside the S Pen must be broken, or there is an obstruction of some sort that makes the phone think that there is no pen in the phone. give it a gentle thump against your other hand to see if it dislodged anything. failing that, book it in for a repair.