If the function has a zero derivative anywhere, then the inverse (if it exists) will not be differentiable (the derivative would be infinity somewhere, which is really to say that it has no derivative at that point). Now, on some domain your function f has no zero derivatives, but if no domain is specified, it will have zero derivatives somewhere. BUT, that doesn't mean that it doesn't have an inverse, it just means that it doesn't have a differentiable inverse. To show that the function is invertible, you simply need to show that it is 1-1, which is precisely what the horizontal line test shows.
What does it mean to be 1-1 (one to one)? It means that two different x values, x1 and x2, will not give the same value f(x1) = f(x2). And think about the horizontal line test, isn't that exactly what it's about? So, without a graph, can you show that there are no two different x values for which the function takes the same value? Suppose f(a) = f(b), i.e. f takes on the same value at a and at b.
a + cos(a) = b + cos(b)
[cos(b) - cos(a)]/(b - a) = -1
This is to say that you can draw a secant through the curve (x, cos(x)) with slope -1, intersecting the curve at points (a, cos(a)) and (b, cos(b)). Suppose we have a pair of points through which the secant is less than -1. Then by mean value theorem, we'd have a place where cos(x) had a slope of less than -1, which is impossible, so -1 is the smallest possible value for a secant. Choose some c such that a < c < b, and we know that:
[cos(c) - cos(a)]/(c - a) > -1
Suppose it is greater than -1, then [cos(b) - cos(c)]/(b - c) < -1, which would imply there is some d in (c, b) with cos'(d) < -1, which is impossible, so it cannot be greater than -1. Suppose it is -1, then [cos(b) - cos(c)]/(b - c) = -1. Then there is some d in (c, b) with cos'(d) = -1, and some e in (a, c) with cos'(e) = -1. but this requires d - e = 2kpi, for some positive integer k. But then b - a > 2kpi, so:
cos(b) - cos(a) < 2kpi, which is impossible because cos(b) - cos(a) < 2. We have a contradiction, so there are no a, b satisfying:
[cos(b) - cos(a)]/(b - a) = -1
hence our function is 1-1, and hence invertible.