The simplest solution is to not use symbols inside of your subscripts:
D[Subscript["k", "x"], x] 0
In StandardForm, they look the same:
{Subscript[k, x], Subscript["k", "x"]} Addendum
If you must use symbols instead of strings, then you can change a system option so that Subscript objects are not differentiable:
SetSystemOptions[ "DifferentiationOptions" -> "ExcludedFunctions" -> DeleteDuplicates @ Append[ OptionValue[SystemOptions[], "DifferentiationOptions"->"ExcludedFunctions"], Subscript ] ]; Then:
D[Subscript[k, x], x] //InputForm D[Subscript[k, x], x]
Mathematica knows there's an x inside the subscript, so it thinks the result isn't 0, but the "ExcludedFunctions" setting means Mathematica doesn't know what to do with the subscript. So, we need to define an UpValues:
D[_Subscript, __] ^:= 0 Now:
D[Subscript[k, x], x] 0
