We develop a technique to automatically generate a control policy for a robot moving in an environment that includes elements with unknown, randomly changing behavior. The robot is required to achieve a surveillance mission, in which a certain request needs to be serviced repeatedly, while the expected time inbetween consecutive services is minimized and additional temporal logic constraints are satisfied. We define a fragment of linear temporal logic to describe such a mission and formulate the problem as a temporal logic game. Our approach is based on two main ideas. First, we extend results in automata learning to detect patterns of the unknown behavior of the elements in the environment. Second, we employ an automata-theoretic method to generate the control policy. We show that the obtained control policy converges to an optimal one when the partially unknown behavior patterns are fully learned. In addition, we illustrate the method in an experimental setup, in which an unmanned ground vehicle, with the help of a cooperating unmanned aerial vehicle (UAV), satisfies a temporal logic requirement in a partitioned environment whose regions are controlled by barriers with unknown behavior.